首页 > 代码库 > 某网站转刷器
某网站转刷器
某网站转刷器
#!/usr/bin/python # -*- coding: utf-8 -*- import requests import time import urllib2 import re import BeautifulSoup #you need to install BeautifulSoup and requests modules from http://pypi.python.org/ manuelly def 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=http://www.mamicode.com/postdata, headers=headers)"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个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。