Created
July 21, 2013 15:07
-
-
Save holys/6048819 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
#-*- coding: UTF-8 -*- | |
import requests | |
import re | |
url = 'http://www.douban.com/group/machome/discussion?start=%d' | |
topic_ptn = re.compile(r'href=\"(.+?group/topic.+?)/\"') | |
user_ptn = re.compile(r'chendahui007') | |
for i in range(0, 200, 25): | |
u = url % i | |
res = requests.get(u).text | |
topics = topic_ptn.findall(res) | |
for topic in topics: | |
if user_ptn.findall(requests.get(topic).text): | |
print topic | |
else: | |
print "这个topic没找到我的回复" | |
print "第%s页" % i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment