Created
October 9, 2012 06:35
-
-
Save freetstar/3857000 to your computer and use it in GitHub Desktop.
从多看论坛下载论坛屏保附件
This file contains hidden or 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
| #!/usr/bin/env python2 | |
| #-*- coding=utf-8 -*- | |
| import urllib2 | |
| from BeautifulSoup import BeautifulSoup | |
| start_page = 1 | |
| end_page = 38 | |
| base_url="http://bbs.duokan.com/forum/thread-41804-%s-1.html" | |
| img_list = [] | |
| f = open('./imgfilelist','r+') | |
| for i in xrange(start_page,end_page): | |
| url = base_url % i | |
| content = urllib2.urlopen(url) | |
| soup = BeautifulSoup("".join(content)) | |
| for img in soup.findAll("img",{'class':'zoom'}): | |
| try: | |
| f.write(str(img['file'])) | |
| f.write('\n') | |
| except KeyError: | |
| pass | |
| f.close() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
then 可以使用wget -i imgfilelist下载屏保照片