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 | ea449923cba31e71204083ffe9758250b43c7943 (patch) | |
tree | 727098ae111824d66f3ef07566fe0519cfc370c6 | |
parent | 9cc3c774f05a887945f219fbb5933cd0ef20d95f (diff) | |
download | comedyGenerator-ea449923cba31e71204083ffe9758250b43c7943.tar.gz comedyGenerator-ea449923cba31e71204083ffe9758250b43c7943.tar.bz2 comedyGenerator-ea449923cba31e71204083ffe9758250b43c7943.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!") |