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
commit670479f28471d9ad782fdff81034f89ca02ab0d8 (patch)
tree0a01746e5edc95659646bacec39dd07f71d8b024
parent0191746a18c55bb32021453197f14f17ed52fa54 (diff)
downloadcomedyGenerator-670479f28471d9ad782fdff81034f89ca02ab0d8.tar.gz
comedyGenerator-670479f28471d9ad782fdff81034f89ca02ab0d8.tar.bz2
comedyGenerator-670479f28471d9ad782fdff81034f89ca02ab0d8.zip
broke it again
-rwxr-xr-xcomedyGenerator41
1 files changed, 21 insertions, 20 deletions
diff --git a/comedyGenerator b/comedyGenerator
index bd015b7..7925367 100755
--- a/comedyGenerator
+++ b/comedyGenerator
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import requests
import urllib.request
-import urllib3.exceptions
import sys
import os
import argparse
@@ -124,7 +123,7 @@ elif args.usingJavascript:
except:
if tries < 100 - 1:
print("Rate Limited! Sleeping for " + str(tries*1.5) + " seconds!")
- time.sleep(tries*1.5)
+ #time.sleep(tries*1.5)
continue
break
@@ -137,35 +136,37 @@ elif args.usingJavascript:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
isTimesScrolled = isTimesScrolled + 1
time.sleep(3)
+ if args.debug:
+ print("Need to scroll " + str(oughtTimeScrolled-isTimesScrolled) + " more times...")
+ 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)
+ 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:
+ print("Now running for " + str(video))
URL = video.get_attribute("data-src")
if isinstance(URL, str):
if args.debug:
print("URL read as: " + URL)
- name = tags + "-" + hashlib.md5(URL.encode('utf-8')).hexdigest() + ".mp4"
- if args.debug:
- print("name read as: " + name)
- print("saving " + video.get_attribute("data-src") + " as " + name)
- for tries in range(100):
- try:
- urllib.request.urlretrieve(video.get_attribute("data-src"), '/home/' + os.environ['USER'] + '/Videos/unsorted/' + name)
- except:
- if tries < 100 - 1:
- print("Rate Limited! Sleeping for " + str(tries*1.5) + " seconds!")
- time.sleep(tries*1.5)
- continue
- break
+ name = tags + "-" + hashlib.md5(URL.encode('utf-8')).hexdigest() + ".mp4"
+ if args.debug:
+ print("name read as: " + name)
+ print("saving " + video.get_attribute("data-src") + " as " + name)
+ for tries in range(100):
+ try:
+ urllib.request.urlretrieve(video.get_attribute("data-src"), '/home/' + os.environ['USER'] + '/Videos/unsorted/' + name)
+ except:
+ if tries < 100 - 1:
+ print("Rate Limited! Sleeping for " + str(tries*1.5) + " seconds!")
+ time.sleep(tries*1.5)
+ continue
+ break
+
elif args.debug:
print("URL is NOT a string, it is a " + str(type(URL)))
print("URL was " + URL)