Skip to content

Instantly share code, notes, and snippets.

@antoinealb
Last active December 14, 2015 23:29
Show Gist options
  • Save antoinealb/5166505 to your computer and use it in GitHub Desktop.
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.
#!/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