PEE.CX 是哪个大佬的站?
[*][*]
[*]复制代码
就是这个 py版本1
[*]#!/usr/bin/python
[*]#encoding=utf-8
[*]import requests
[*]from bs4 import BeautifulSoup
[*]import re
[*]import sys
[*]import datetime
[*]
[*]
[*]uid="username" #用户名
[*]pwd="userpasswd" #密码
[*]
[*]
[*]http = requests.Session()
[*]http.headers.update({
[*] 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
[*] ,'Accept-Language':"zh-CN,zh;q=0.8,ko;q=0.6,zh-TW;q=0.4"
[*]})
[*]#http.proxies = {"http":"http://127.0.0.1:8080","https":"http://127.0.0.1:8080"}
[*]
[*]##打开登陆界面
[*]res=http.get("http://www.hostloc.com/member.php?mod=logging&action=login&infloat=yes&handlekey=login&inajax=1&ajaxtarget=fwin_content_login")
[*]match=re.search(r'name="formhash" value="(\S+)"',res.text)
[*]if(match):
[*] formhash=match.group(1)
[*]else:
[*] exit(0)
[*]
[*]##登陆
[*]form={
[*] "formhash":formhash
[*] ,"referer":"http://www.hostloc.com/thread-12949-1-1.html"
[*] ,"loginfield":"username"
[*] ,"username":uid
[*] ,"password":pwd
[*] ,"questionid":0
[*] ,"answer":""
[*] ,"loginsubmit":"true"
[*]}
[*]res=http.post("http://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=LWKbr&inajax=1",data=form)
[*]match=re.search(r"'uid':'",res.text)
[*]if(match):
[*] print("登陆成功")
[*]else:
[*] print("登陆失败")
[*] exit(0)
[*]##查询今天访问的空间数量
[*]res=http.get("http://www.hostloc.com/home.php?mod=spacecp&ac=credit&op=log&suboperation=creditrulelog")
[*]bs=BeautifulSoup(res.text,"html.parser")
[*]td=bs.find('td',string="访问别人空间")
[*]if(td==None):
[*] print("信息获取失败")
[*] exit(0)
[*]tds=td.parent.find_all("td")
[*]today_view_count=int(tds.text) #今天已经翻牌数
[*]last_view_date=tds.text #上次翻牌时间,这个时间不会自动刷新,所以不能仅仅依据数量就决定不翻牌
[*]need_view=last_view_date.find(datetime.datetime.now().strftime("%Y-%m-%d"))==-1 #上次翻牌时间是不是今天,不是今天则需要翻
[*]if(today_view_count>=10 and (not need_view)): #不论数量多少,只要上次翻牌时间不是今天就翻。上次翻牌是今天才去判断数量
[*] print("今日累了,明日再翻!")
[*] exit(0)
[*]##去首页获取等待临幸的网址
[*]res=http.get("http://www.hostloc.com/forum-45-1.html")
[*]users =re.findall("(space-uid\S+)"",res.text)
[*]viewed=set()
[*]num=0
[*]while num 复制代码
py版本2
[*]#-*- coding=utf-8 -*-
[*]import requests
[*]import re
[*]import cookielib
[*]import sys
[*]
[*]index='http://www.hostloc.com/'
[*]page_url='http://www.hostloc.com/forum-45-1.html'
[*]credit_url='http://www.hostloc.com/home.php?mod=spacecp&ac=credit&showcredit=1'
[*]login_url='http://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1'
[*]login_data={
[*] 'fastloginfield':'username'
[*] ,'username':''
[*] ,'cookietime':'2592000'
[*] ,'password':''
[*] ,'quickforward':'yes'
[*] ,'handlekey':'ls'
[*] }
[*]headers={
[*] 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
[*] ,'Accept-Encoding':'gzip, deflate, sdch'
[*] ,'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6'
[*] ,'Host':'www.hostloc.com'
[*] ,'Referer':'http://www.hostloc.com/forum.php'
[*] ,'Upgrade-Insecure-Requests':'1'
[*] ,'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
[*]}
[*]
[*]
[*]class HostLoc():
[*] def __init__(self,username,passwd):
[*] self.username=username
[*] self.passwd=passwd
[*] login_data['username']=username
[*] login_data['password']=passwd
[*] self.session=requests.Session()
[*] self.session.headers=headers
[*] self.login()
[*] self.pass_jdkey()
[*]
[*]
[*] def pass_jdkey(self):
[*] html=self.session.get(index).content
[*] try:
[*] jdkey=re.findall('jdfwkey=(.*?)"')
[*] except:
[*] jdkey=''
[*] url=index+'?jdfwkey='+jdkey
[*] self.session.get(index)
[*]
[*] def login(self):
[*] self.session.post(login_url,data=login_data)
[*]
[*] def isLogin(self):
[*] url='http://www.hostloc.com/home.php?mod=spacecp'
[*] html=self.session.get(url).content
[*] UserName=re.findall(self.username,html)
[*] if len(UserName)==0:
[*] return False
[*] else:
[*] return True
[*]
[*] def get_credit(self):
[*] html=self.session.get(credit_url).content
[*] credit_pattern=re.compile(r' 金钱: (.*?).*? [\w\W]*?[*] 威望: (.*?) [\w\W]*?积分: (.*?) ')
[*] try:
[*] credit=credit_pattern.findall(html)
[*] coin,wh,jf=credit
[*] print u"金币:%s,威望:%s,积分:%s"%(coin,wh,jf)
[*] return True
[*] except:
[*] print u"获取数据失败,请稍后再试"
[*] return False
[*]
[*] def get_user(self):
[*] print('parse '+page_url)
[*] self.html=self.session.get(page_url).content
[*] user_pattern=re.compile('space-uid-\d+?.html')
[*] users=list(set(user_pattern.findall(self.html)))
[*] self.users=
[*]
[*] def visit_user(self):
[*] for user in self.users[:10]:
[*] print('visit user '+user)
[*] self.session.get(user)
[*]
[*]
[*]
[*]if __name__=='__main__':
[*] username='' #用户名
[*] passwd='' #密码
[*] hostloc=HostLoc(username,passwd)
[*] if hostloc.get_credit():
[*] hostloc.get_user()
[*] hostloc.visit_user()
[*] hostloc.get_credit()
[*] else:
[*] sys.exit(0)复制代码
py洁癖版(需要自己动手修改部分)
[*]import requests
[*]import time
[*]s = requests.Session()
[*]s.post("http://www.hostloc.com/member.php", {'username':'XXXX', 'password': 'xxxxxx',})
[*]urls = ["http://www.hostloc.com/space-uid-{}.html".format(str(i)) for i in range(10000, 24000)]
[*]for i in urls:
[*] s.get(i)
[*] time.sleep(3)复制代码
php版
[*] 'logging',
[*] 'action' => 'login',
[*] 'loginsubmit' => 'yes',
[*] 'infloat' => 'yes',
[*] 'lssubmit' => 'yes',
[*] 'username' => '账号',
[*] 'password' => '密码'
[*]);
[*]$url = "http://www.hostloc.com/member.php";
[*]$cookie = dirname(__FILE__) . '/cookie_lochost.txt';
[*]login_post($url, $cookie, $post);
[*]for ($i = 0; $i
[*]复制代码
当然 还有exe版 我就不放了
008.gif
http://hunter.gitlab.io/app/hostloc/ 收藏一下代码
救世主 发表于 2018-1-8 13:34
对对对,原来是大佬的站!看到 "刷分完毕" 就知道是你的了
大佬,这个代码怎么用?怎么和普通的网页代码 ...
都一样 会自动补全的
救世主 发表于 2018-1-8 13:34
对对对,原来是大佬的站!看到 "刷分完毕" 就知道是你的了
大佬,这个代码怎么用?怎么和普通的网页代码 ...
都一样 会自动补全的一直在用这个:http://mangogod.oschina.io/hostloc/
Zennoposter每天6点自动点。
means 发表于 2018-1-8 13:24
http://hunter.gitlab.io/app/hostloc/
我也用的这个
页:
[1]