summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcomedyGenerator14
1 files changed, 12 insertions, 2 deletions
diff --git a/comedyGenerator b/comedyGenerator
index 01eb216..48ed69f 100755
--- a/comedyGenerator
+++ b/comedyGenerator
@@ -1,6 +1,7 @@
#!/usr/bin/python3
import requests
import urllib.request
+import urllib3.exceptions
import sys
import os
import argparse
@@ -79,7 +80,16 @@ elif args.usingJavascript:
print("If you are using GNU/Linux, it is likely that you can install from your standard repos. Debian labels their chromium driver chromium-driver. If you wish to use an ungoogled version of chromium (as to reduce possiblity of spying), you can find a link to that here: https://github.com/Eloston/ungoogled-chromium#downloads. On Debian (or debian likes such as Ubuntu or Devuan), you may then run apt install ungoogled-chromium-driver and this will no longer fail.")
sys.exit()
for tags in args.tags:
- driver.get('https://ifunny.co/tags/' + tags + '?filter=video')
+ for tries in range(100):
+ try:
+ 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)
+ continue
+ break
+
if args.amount > 0:
isTimesScrolled = 0
oughtTimeScrolled = (args.amount/10) + 1
@@ -95,7 +105,7 @@ elif args.usingJavascript:
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')
- driver.quit()
+ driver.close()
else: