Skip to content

Instantly share code, notes, and snippets.

@starenka starenka/historje
Created Oct 5, 2013

Embed
What would you like to do?
fetches all images from http://historje.tumblr.com and makes a pdf from them
#!/usr/bin/env python
from pyquery import PyQuery as pq
import requests
bigs = []
for y in (2012,2013):
for m in range(1,13):
try:
doc = pq(requests.get('http://historje.tumblr.com/archive/%d/%d' % (y,m)).content)
imgs = doc.find('div.has_imageurl')
bigs += map(lambda x: pq(x).attr('data-imageurl').replace('_500.','_1280.'), imgs)
except Exception as e:
print e
fh = open('links','w')
fh.write('\n'.join(set(bigs)))
fh.close()
print """
./historje.py
mkdir img
cd img
cat ../links | uniq | xargs -P 10 -r -n 1 wget -nv
convert * do_$(date +"%d-%m-%y").pdf
cd -
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.