diff options
author | msglm <msglm@techchud.xyz> | 2023-01-11 20:51:07 -0600 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-01-11 20:51:07 -0600 |
commit | b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d (patch) | |
tree | 727098ae111824d66f3ef07566fe0519cfc370c6 | |
parent | cf99fcd832865caf11579ec425ec25cd08dbdc91 (diff) | |
download | comedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.tar.gz comedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.tar.bz2 comedyGenerator-b3f9a2d5fb59b9ef45f9d94b16b816e56dcb7a7d.zip |
added extra rate limiting
-rwxr-xr-x | comedyGenerator | 15 |
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!") |