Skip to content

Instantly share code, notes, and snippets.

@holys
Created July 21, 2013 15:07
Show Gist options
  • Save holys/6048819 to your computer and use it in GitHub Desktop.
Save holys/6048819 to your computer and use it in GitHub Desktop.
#!/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