summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcomedyGenerator36
1 files changed, 21 insertions, 15 deletions
diff --git a/comedyGenerator b/comedyGenerator
index ac5b3da..894acc4 100755
--- a/comedyGenerator
+++ b/comedyGenerator
@@ -149,21 +149,27 @@ elif args.usingJavascript:
print("Videos list truncated! Its now: " + str(len(videos)) + " units long")
for video in videos:
URL = video.get_attribute("data-src")
- 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
+ if isinstance(URL, str) and args.debug == True:
+ print("URL is a string!")
+ else:
+ print("URL is NOT a string, it is a " + str(type(URL)))
+
+ 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
driver.quit()
else: