summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcomedyGenerator15
1 files changed, 12 insertions, 3 deletions
diff --git a/comedyGenerator b/comedyGenerator
index 1ba068e..c64044e 100755
--- a/comedyGenerator
+++ b/comedyGenerator
@@ -85,8 +85,8 @@ elif args.usingJavascript:
driver.get('https://ifunny.co/tags/' + tags + '?filter=video')
except:
if tries < 100 - 1:
- print("Rate Limited! Sleeping for " + str(tries*12) + " seconds!")
- time.sleep(tries*12)
+ print("Rate Limited! Sleeping for " + str(tries*1.5) + " seconds!")
+ time.sleep(tries*1.5)
continue
break
@@ -104,7 +104,16 @@ elif args.usingJavascript:
for video in videos:
epoch = epoch + 1
print("saving " + video.get_attribute("data-src") + " as " + str(epoch) + '.mp4')
- urllib.request.urlretrieve(video.get_attribute("data-src"), '/home/' + os.environ['USER'] + '/Videos/unsorted/' + str(epoch) + '.mp4')
+ for tries in range(100):
+ try:
+ urllib.request.urlretrieve(video.get_attribute("data-src"), '/home/' + os.environ['USER'] + '/Videos/unsorted/' + str(epoch) + '.mp4')
+ 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:
print("Neither Javascript or HTML was given!")