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
commitb3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d (patch)
tree727098ae111824d66f3ef07566fe0519cfc370c6
parentcf99fcd832865caf11579ec425ec25cd08dbdc91 (diff)
downloadcomedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.tar.gz
comedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.tar.bz2
comedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.zip
added extra rate limiting
-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!")