first prototype
commit
97c4bc42e0
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
# import libraries
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
import os
|
||||
import time
|
||||
import datetime
|
||||
|
||||
today = datetime.date.today()
|
||||
|
||||
# get the url from the terminal
|
||||
url = input("Enter instance.social url (include https:// etc.): ")
|
||||
|
||||
# Tell Selenium to open a new Firefox session
|
||||
# and specify the path to the driver
|
||||
driver = webdriver.Firefox(executable_path=os.path.dirname(os.path.realpath(__file__)) + '/geckodriver')
|
||||
|
||||
# Implicit wait tells Selenium how long it should wait before it throws an exception
|
||||
driver.implicitly_wait(10)
|
||||
driver.get(url)
|
||||
time.sleep(3)
|
||||
|
||||
d = 1
|
||||
|
||||
while True:
|
||||
|
||||
driver.find_element_by_css_selector('a.list-group-item:nth-child(%d)'%d).click()
|
||||
instance_url = driver.find_element_by_xpath('//h5')
|
||||
description = driver.find_element_by_id('modalInstanceInfo-description')
|
||||
print ('Instance:')
|
||||
print(instance_url.text)
|
||||
print ('Description:')
|
||||
print(description.text)
|
||||
time.sleep(0.5)
|
||||
|
||||
# closes pop up
|
||||
driver.find_element_by_css_selector('.btn.btn-secondary').click()
|
||||
time.sleep(0.5)
|
||||
|
||||
# scroll to just under the video in order to load the comments
|
||||
driver.execute_script('window.scrollTo(1, 40);')
|
||||
time.sleep(0.5)
|
||||
|
||||
d+=1
|
||||
|
||||
# close the browser
|
||||
driver.close()
|
Loading…
Reference in New Issue