Skip to content

Commit

Permalink
修复一个下一页的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
atupal committed Jun 15, 2013
1 parent bffa489 commit 306a233
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dianzan/dianzan_py-dom-xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,21 @@ def dianzan(self, cnt = 5, op = '1'):
if url:
feed_url = url[0].content
for i in xrange(cnt):
print feed_url
print "feed_url:" + feed_url
content = self.session.get(feed_url).content

urls = self._parse(None, '//*/@href', content = content)
for url in urls:
if url.content.find('like_action') != -1 and url.content[-1] == op:
print self.session.get(url.content).content
ret = self.session.get(url.content).content
if ret.find('成功') != -1:
print '赞成功'

urls = self._parse(None, '//*/@href', content = content)
urls = self._parse(None, '//*[text()="更多好友动态>>" or text()="下页"]/@href', content = content)
for url in urls:
if url.content.find('feeds_friends') != -1 and url.content.find('dayval=1') != -1:
feed_url = url.content
#if url.content.find('feeds_friends') != -1 or url.content.find('dayval=1') != -1:
feed_url = url.content

return 'success'

class Dianzan_verify(Dianzan):
Expand Down

0 comments on commit 306a233

Please sign in to comment.