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
commitbec5ca31143c6c84213f9e3fde56e6eca46fbee1 (patch)
treeaabcebf62276433ea518da77c2a42b15202153a7
parent1d4fb4981f89aa1701810b819b5a9bfacf4407aa (diff)
downloadcomedyGenerator-bec5ca31143c6c84213f9e3fde56e6eca46fbee1.tar.gz
comedyGenerator-bec5ca31143c6c84213f9e3fde56e6eca46fbee1.tar.bz2
comedyGenerator-bec5ca31143c6c84213f9e3fde56e6eca46fbee1.zip
NoneType error fixed
-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: