summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-11 20:51:07 -0600
committermsglm <msglm@techchud.xyz>2023-01-11 20:51:07 -0600
commit1d4fb4981f89aa1701810b819b5a9bfacf4407aa (patch)
tree9263e760539152fb9cd984e79308d3913de052b6
parent7a5dba9771275aa45179c87e1338c8092be8c048 (diff)
downloadcomedyGenerator-1d4fb4981f89aa1701810b819b5a9bfacf4407aa.tar.gz
comedyGenerator-1d4fb4981f89aa1701810b819b5a9bfacf4407aa.tar.bz2
comedyGenerator-1d4fb4981f89aa1701810b819b5a9bfacf4407aa.zip
Updated to account for selenium's by_tag deprectaion
-rwxr-xr-xcomedyGenerator12
1 files changed, 9 insertions, 3 deletions
diff --git a/comedyGenerator b/comedyGenerator
index 0a80a22..ac5b3da 100755
--- a/comedyGenerator
+++ b/comedyGenerator
@@ -27,7 +27,7 @@ parser.add_argument('--debug',
)
parser.add_argument('-js','-JS',"--Javascript",'--javascript',
- default=False,
+ default=True,
action='store_true',
dest='usingJavascript',
help='Enables the user of a webdriver to scrape funnies'
@@ -67,6 +67,7 @@ if not args.usingJavascript:
urllib.request.urlretrieve(video['data-src'], '/home/' + os.environ['USER'] + '/Videos/unsorted/' + name)
elif args.usingJavascript:
from selenium import webdriver
+ from selenium.webdriver.common.by import By
print("using JS mode...")
try:
@@ -136,12 +137,17 @@ elif args.usingJavascript:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
isTimesScrolled = isTimesScrolled + 1
time.sleep(3)
- videos = driver.find_elements_by_tag_name("video")
+ if args.debug:
+ print("Need to scroll " + str(oughtTimeScrolled-isTimesScrolled) + " more times...")
+ videos = driver.find_elements(By.TAG_NAME,"video")
+ if args.debug:
+ print("Original Videos List: ")
+ print(videos)
if args.amount > 0:
videos = videos[:args.amount]
if args.debug:
print("Videos list truncated! Its now: " + str(len(videos)) + " units long")
- for video in videos:
+ for video in videos:
URL = video.get_attribute("data-src")
if args.debug:
print("URL read as: " + URL)