Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2013 17:48
Show Gist options
  • Save anonymous/5066411 to your computer and use it in GitHub Desktop.
Save anonymous/5066411 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Mar 1, 2013.
    8 changes: 8 additions & 0 deletions xx.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import requests
    import lxml.html

    page = requests.get('http://tieba.baidu.com/p/2166231880').text
    doc = lxml.html.document_fromstring(page)
    for idx, el in enumerate(doc.cssselect('img.BDE_Image')):
    with open('%03d.jpg' % idx, 'wb') as f:
    f.write(requests.get(el.attrib['src']).content)