I need to scarpe some information for https://hasjob.co/, I can scrape some of the information by getting through the login page and scrape as usual, but most of information are generated by Javascript only when u scroll down to the bottom of the page.
Any solution using python??
import mechanize
import cookielib
from bs4 import BeautifulSoup
import html2text
import pprint
job = []
# Browser
br = mechanize.Browser()
# Cookie Jar
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
# Browser options
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.addheaders = [('User-agent', 'Chrome')]
# The site we will navigate into, handling it's session
br.open('https://auth.hasgeek.com/login')
# View available forms
##for f in br.forms():
## print f
# Select the second (index one) form (the first form is a search query box)
br.select_form(nr=1)
# User credentials
br.form['username'] = 'username'
br.form['password'] = 'pass'
br.submit()
##print(br.open('https://hasjob.co/').read())
r = br.open('https://hasjob.co/')
soup = BeautifulSoup(r)
for tag in soup.find_all('span',attrs={'class':'annotation bottom-right'}):
p = tag.text
job.append(p)
pp = pprint.PrettyPrinter(depth=6)
pp.pprint(job)