Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2013 17:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save anonymous/5066411 to your computer and use it in GitHub Desktop.
Save anonymous/5066411 to your computer and use it in GitHub Desktop.
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)
@nickcookies6
Copy link

your code is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment