gecko stuff
This commit is contained in:
parent
7d576552fd
commit
d445819661
@ -45,6 +45,8 @@ def main():
|
|||||||
|
|
||||||
def get_goodreads_stats():
|
def get_goodreads_stats():
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'email': os.environ.get('EMAIL'),
|
'email': os.environ.get('EMAIL'),
|
||||||
'password': os.environ.get('PASSW'),
|
'password': os.environ.get('PASSW'),
|
||||||
@ -52,8 +54,12 @@ def get_goodreads_stats():
|
|||||||
|
|
||||||
LOGIN_URL= 'https://www.goodreads.com/user/sign_in'
|
LOGIN_URL= 'https://www.goodreads.com/user/sign_in'
|
||||||
|
|
||||||
driver = webdriver.PhantomJS()
|
#driver = webdriver.Firefox(firefox_binary=FirefoxBinary("/usr/bin/firefox"))
|
||||||
|
print("before driver")
|
||||||
|
driver = webdriver.Firefox()
|
||||||
|
print("after driver")
|
||||||
driver.get(LOGIN_URL)
|
driver.get(LOGIN_URL)
|
||||||
|
print("after login")
|
||||||
|
|
||||||
username = driver.find_element_by_id('user_email')
|
username = driver.find_element_by_id('user_email')
|
||||||
password = driver.find_element_by_id('user_password')
|
password = driver.find_element_by_id('user_password')
|
||||||
@ -67,6 +73,9 @@ def get_goodreads_stats():
|
|||||||
driver.get('https://www.goodreads.com/review/stats/24381583#pages')
|
driver.get('https://www.goodreads.com/review/stats/24381583#pages')
|
||||||
pages = driver.execute_script('return page_stats')
|
pages = driver.execute_script('return page_stats')
|
||||||
books = driver.execute_script('return year_stats')
|
books = driver.execute_script('return year_stats')
|
||||||
|
print("Got stats from goodreads live:")
|
||||||
|
print(pages)
|
||||||
|
print(books)
|
||||||
return pages, books
|
return pages, books
|
||||||
|
|
||||||
def get_stats(pages, books):
|
def get_stats(pages, books):
|
||||||
|
Loading…
Reference in New Issue
Block a user