Skip to content

Instantly share code, notes, and snippets.

@freetstar
Created October 9, 2012 06:35
Show Gist options
  • Select an option

  • Save freetstar/3857000 to your computer and use it in GitHub Desktop.

Select an option

Save freetstar/3857000 to your computer and use it in GitHub Desktop.
从多看论坛下载论坛屏保附件
#!/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()
@freetstar

Copy link
Copy Markdown
Author

then 可以使用wget -i imgfilelist下载屏保照片

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