diff options
author | msglm <msglm@techchud.xyz> | 2025-08-17 19:53:50 -0500 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2025-08-17 19:53:50 -0500 |
commit | 2fdbea5e6eb06c75f6425bc8b1e4300124ff7fd9 (patch) | |
tree | aabcebf62276433ea518da77c2a42b15202153a7 | |
parent | 85d35fd6dcc1f4a1b3ee047d04cbf39e78221290 (diff) | |
download | comedyGenerator-2fdbea5e6eb06c75f6425bc8b1e4300124ff7fd9.tar.gz comedyGenerator-2fdbea5e6eb06c75f6425bc8b1e4300124ff7fd9.tar.bz2 comedyGenerator-2fdbea5e6eb06c75f6425bc8b1e4300124ff7fd9.zip |
NoneType error fixed
-rwxr-xr-x | comedyGenerator | 36 |
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: |