Skip to content

Instantly share code, notes, and snippets.

@lisongx
Created December 24, 2011 15:04
Show Gist options
  • Save lisongx/1517515 to your computer and use it in GitHub Desktop.
Save lisongx/1517515 to your computer and use it in GitHub Desktop.
download the hacker monthly issue
from fabric.api import local, run
from pyquery import PyQuery as pq
BASE_URL = "http://hackermonthly.com/"
HACKER_URL = "http://hackermonthly.com/issues.html"
d = pq(url=HACKER_URL)
issue_list = d("#issues li a")
def get_issue(inex, node):
d = pq(node)
url = d.attr("href")
issue_url = BASE_URL + url
e = pq(issue_url)
download_url = e('#mag-content p.buttons a').eq(0).attr("href")
local("wget %s"%download_url.strip())
issue_list.each(get_issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment