Created
December 24, 2011 15:04
-
-
Save lisongx/1517515 to your computer and use it in GitHub Desktop.
download the hacker monthly issue
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
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