Skip to content

Instantly share code, notes, and snippets.

@Shadey
Last active August 29, 2015 14:01
Show Gist options
  • Save Shadey/49d9d36f0dbc402690a0 to your computer and use it in GitHub Desktop.
Save Shadey/49d9d36f0dbc402690a0 to your computer and use it in GitHub Desktop.
#!usr/bin/python
import sys
import urllib
from bs4 import BeautifulSoup as BS
if len(sys.argv) != 2:
print "Usage: %s thread_url"%(sys.argv[0])
sys.exit()
soup=BS(urllib.urlopen(sys.argv[1]).read())
for link in soup.find_all("p", class_="fileinfo"):
src = "https://lainchan.org"+link.find_next("a")['href'].encode("UTF-8")
filename = src.split("/")[-1].encode("UTF-8")
print "Getting %s" % src
urllib.urlretrieve(src,filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment