某網站轉刷器

來源:互聯網
上載者:User

標籤:轉刷器

某網站轉刷器

#!/usr/bin/python# -*- coding: utf-8 -*-import requestsimport timeimport urllib2import reimport BeautifulSoup#you need to install BeautifulSoup and requests modules from http://pypi.python.org/ manuellydef main():    url = ‘http://www.the_web_site.com/login.aspx‘    headers = {‘content-type‘: ‘application/x-www-form-urlencoded‘}        #use requests to keep the cookies    session = requests.Session()    response = session.get(url, headers=headers)        #use beautifulsoup module to retrieve hidden postdata __VIEWSTATE and __EVENTVALIDATION    soup = BeautifulSoup.BeautifulSoup(response.content)        postdata = {        ‘__VIEWSTATE‘: soup.find(‘input‘, id=‘__VIEWSTATE‘)[‘value‘],        ‘__EVENTVALIDATION‘: soup.find(‘input‘, id=‘__EVENTVALIDATION‘)[‘value‘],        ‘ctl00$ContentPlaceHolder1$UserName1‘: ‘username‘,        ‘ctl00$ContentPlaceHolder1$Password1‘: ‘password‘,        ‘ctl00$ContentPlaceHolder1$RememberMe1‘: ‘on‘,        ‘ctl00$ContentPlaceHolder1$LoginButton1.x‘: ‘46‘,        ‘ctl00$ContentPlaceHolder1$LoginButton1.y‘: ‘0‘    }        #login to the site    response = session.post(url, data=postdata, headers=headers)    print response    #search_file_write(response)        #get the web page content    output = session.get(‘http://www.the_web_site.com/the_web_page.aspx‘)    print output    #search_file_write(output)    respHtml = output.text    #print respHtml    #print type(respHtml)        #check the webpage whether there have something you want    found_s = re.search(u‘http://www.the_web_site.com/\d{7}.aspx\?sjuser=.{14}‘, respHtml)        found_p = re.search(u‘分</span>:\d{1,3}分‘, respHtml)    print "found =",found_s        if(found_s):        #print the search result        print "\033[1;32;40mThere have something !\033[0m"        s_link = found_s.group(0)        s_point = found_p.group(0)        print "URL=",s_link        print "Point=",s_point    else:        print "\033[1;31;40mno found.\033[0m"def search_file_write(find_url):    spath = "record.txt"    f = open(spath,‘a‘)    f.write(u"%s  \n"  %find_url)    f.close()if __name__=="__main__":    while True:        main()        time.sleep(30)


本文出自 “葡萄呀 Enjoy your life” 部落格,謝絕轉載!

某網站轉刷器

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.