Last active
December 14, 2015 23:29
-
-
Save antoinealb/5166505 to your computer and use it in GitHub Desktop.
This scripts opens all the given thread's images in chromium, for those who like to live dangerously.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests, sys, subprocess | |
from bs4 import BeautifulSoup | |
def main(): | |
if len(sys.argv) < 2: | |
print("Usage {0} thread_url".format(sys.argv[0])) | |
return | |
soup = BeautifulSoup(requests.get(sys.argv[1]).text) | |
with open('/dev/null', 'w') as outfile: | |
images = soup.find_all("a", {"class":"fileThumb"}) | |
for (index, image) in enumerate(images): | |
print("Opening {0}/{1}".format(index+1, len(images))) | |
subprocess.call(["chromium", "--incognito", "http:"+image["href"]], stdout=outfile, stderr=outfile) | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment