• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            infinity

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              36 隨筆 :: 0 文章 :: 25 評論 :: 0 Trackbacks
             1 #encoding:utf-8
             2 import urllib,urllib2,cookielib,re,time
             3 class renren():
             4     def __init__(self,email,password):
             5         self.url='http://www.renren.com/'
             6         self.email=email
             7         self.password=password
             8         self.cookie=cookielib.LWPCookieJar() 
             9         self.opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
            10         self.friendIdList=[]
            11     def login(self):
            12         url=self.url+'PLogin.do/'
            13         params=urllib.urlencode({'email':self.email,'password':self.password})
            14         response=self.opener.open(urllib2.Request(url,params))
            15         url=self.url+'home'
            16         if response.geturl()==url:
            17             print 'Login Succesfully!'
            18             self.cookie.save('xiaonei.coockie')  
            19         else:
            20             print 'Login Failed'
            21 
            22     def changeState(self):
            23         pass
            24 
            25     def getFriendList(self):
            26         url='http://friend.renren.com/myfriendlistx.do'
            27         response=self.opener.open(urllib2.Request(url))
            28         html=response.read()
            29         friend=str(re.search('friends=\[{.*}\]',html).group())
            30         friendId=re.findall('"id":\d+',friend)
            31         for id in friendId:
            32             self.friendIdList.append(id.lstrip('"id":'))
            33 
            34     def browseFriend(self):
            35         cnt=0
            36         for friendId in self.friendIdList:
            37             cnt+=1
            38             url='http://www.renren.com/profile.do?id='+'%s'%(friendId)
            39             urllib2.Request(url)
            40             time.sleep(1)
            43 if __name__=='__main__':
            44     app=renren('your email','your password')
            45     app.login()
            46     app.changeState()
            47     app.getFriendList()
            48     app.browseFriend()
            49
            50
            changeState 因?yàn)椴恢涝趺捶治鲂?nèi)的表單提交方式,他的源碼沒法查看出表單時提交到哪里了,所以不好寫,而類似getFriendList,訪問好友啊這樣的操作則是可以的,同樣還可以寫日志啊什么的。

            有誰能告訴我怎么分析校內(nèi)這種隱藏的表單
            <input type="submit" autocomplete="false" id="publisher_submit" class="submit" value="發(fā)布" stats="Pub_Send">
            是后臺的js代碼么

            不過話說回來,python的urllib,urllib2什么的倒是很好用,做一些相關(guān)的應(yīng)用都是很簡單的

            posted on 2011-01-20 06:26 infinity 閱讀(1260) 評論(0)  編輯 收藏 引用 所屬分類: python
            日本五月天婷久久网站| 久久精品九九亚洲精品| 伊人色综合久久| 久久综合一区二区无码| 久久人人爽人人爽人人片AV东京热 | 97久久天天综合色天天综合色hd| 97精品久久天干天天天按摩| 7777久久亚洲中文字幕| 欧美久久久久久午夜精品| 无码超乳爆乳中文字幕久久 | 99久久精品免费看国产一区二区三区| 久久亚洲天堂| 麻豆一区二区99久久久久| 国产成人精品久久综合| 伊人久久久AV老熟妇色| 国产亚州精品女人久久久久久 | 久久青青草原国产精品免费| 性做久久久久久久久| 亚洲国产成人久久精品动漫| 国产精品99久久久精品无码| 久久久久久国产精品无码下载 | 久久精品国产亚洲精品2020| 亚洲国产成人久久精品99| 91精品国产91久久久久久| 久久久久99精品成人片试看| 色妞色综合久久夜夜| 久久久久人妻一区精品| 久久这里只精品国产99热| 久久99精品久久久久久不卡| 久久亚洲精品成人AV| 久久伊人五月丁香狠狠色| 青青青国产成人久久111网站| 亚洲欧美日韩久久精品第一区| 久久久精品人妻无码专区不卡| 久久香蕉国产线看观看99| 亚洲中文久久精品无码ww16| 久久午夜福利无码1000合集| 无码精品久久一区二区三区 | 狠狠色综合久久久久尤物| 99久久人妻无码精品系列| 久久水蜜桃亚洲av无码精品麻豆|