|
|
- # -*- coding: utf8 -*-
- import requests
- import re
- from urllib.parse import quote
- from datetime import *
- bjtime=str(datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(timezone(timedelta(hours=8)))).split('.')[0]
- def start():
- s = requests.session()
- username = '账号账号账号账号'
- password = '密码密码密码密码'
- headers={
- 'Host': 'www.hostloc.com',
- 'Connection': 'keep-alive',
- 'Cache-Control': 'max-age=0',
- 'Origin': 'https://loc.442266.xyz',
- 'Upgrade-Insecure-Requests': '1',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36',
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
- 'Referer': 'https://loc.442266.xyz/forum.php',
- 'Accept-Encoding': 'gzip, deflate',
- 'Accept-Language': 'zh-HK,zh;q=0.9,zh-CN;q=0.8,en-US;q=0.7,en;q=0.6,zh-TW;q=0.5'
- }
- login_url = 'https://loc.442266.xyz/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1'
- s.post(login_url, {'fastloginfield':'username','quickforward':'yes','handlekey':'1s',"username": username, 'password': password}, headers=headers)
- user_info = s.get('https://loc.442266.xyz/home.php?mod=spacecp&ac=credit', headers=headers).text
- current_money = re.search(r'积分: </em>(\d+).+?</li>', user_info).group(1)
- print("用户%s,签到前你的积分为%s" % (username, current_money))
- for i in range(20359, 20370):
- s.get('https://loc.442266.xyz/space-uid-%s.html' % i, headers=headers)
- new_money = s.get('https://loc.442266.xyz/home.php?mod=spacecp&ac=credit', headers=headers).text
- new_money = re.search(r'积分: </em>(\d+).+?</li>', new_money).group(1)
- print("用户%s,签到后你的积分为%s" % (username, new_money))
- def main_handler(event, context):
- return start()
- if __name__ == '__main__':
- start()
复制代码 |
|