全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1920|回复: 11
打印 上一主题 下一主题

LOC云函数挂机求指导,反正我看不懂。。。

[复制链接]
跳转到指定楼层
1#
发表于 2019-1-20 23:08:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
推荐
发表于 2019-1-21 08:33:44 | 只看该作者
Error 4xx Client Errors 登录后返回的这个页面
2#
发表于 2019-1-20 23:20:25 来自手机 | 只看该作者
最近规则改了吧
3#
发表于 2019-1-20 23:41:49 来自手机 | 只看该作者
s.get和s.post要带headers,把agent和ref属性带上
4#
发表于 2019-1-21 00:22:31 | 只看该作者
错误提示是说
19行这里的正则没有匹配到东西 re.search(r'积分: </em>(\d+).+?</li>', user_info) 为空
所以报NoneType没有group属性的错误

你只能一步一步往上查了
5#
发表于 2019-1-21 00:50:24 来自手机 | 只看该作者
yjsx86 发表于 2019-1-21 00:22
错误提示是说
19行这里的正则没有匹配到东西 re.search(r'积分: (\d+).+?', user_info) 为空
所以报NoneTyp ...

就是我说的,要带headers,楼主应该跟我一样用的loc大佬的代码。
6#
 楼主| 发表于 2019-1-21 01:55:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
7#
发表于 2019-1-21 02:44:15 | 只看该作者
  1. # -*- coding: utf8 -*-

  2. import requests
  3. import re
  4. from urllib.parse import quote
  5. from datetime import *
  6. bjtime=str(datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(timezone(timedelta(hours=8)))).split('.')[0]


  7. def start():
  8.     s = requests.session()
  9.     username = '账号账号账号账号'
  10.     password = '密码密码密码密码'

  11.     headers={
  12.         'Host': 'www.hostloc.com',
  13.         'Connection': 'keep-alive',
  14.         'Cache-Control': 'max-age=0',
  15.         'Origin': 'https://loc.442266.xyz',
  16.         'Upgrade-Insecure-Requests': '1',
  17.         'Content-Type': 'application/x-www-form-urlencoded',
  18.         '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',
  19.         'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  20.         'Referer': 'https://loc.442266.xyz/forum.php',
  21.         'Accept-Encoding': 'gzip, deflate',
  22.         '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'
  23.     }
  24.     login_url = 'https://loc.442266.xyz/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1'
  25.     s.post(login_url, {'fastloginfield':'username','quickforward':'yes','handlekey':'1s',"username": username, 'password': password}, headers=headers)

  26.     user_info = s.get('https://loc.442266.xyz/home.php?mod=spacecp&ac=credit', headers=headers).text

  27.     current_money = re.search(r'积分: </em>(\d+).+?</li>', user_info).group(1)
  28.     print("用户%s,签到前你的积分为%s" % (username, current_money))

  29.     for i in range(20359, 20370):
  30.         s.get('https://loc.442266.xyz/space-uid-%s.html' % i, headers=headers)

  31.     new_money = s.get('https://loc.442266.xyz/home.php?mod=spacecp&ac=credit', headers=headers).text
  32.     new_money = re.search(r'积分: </em>(\d+).+?</li>', new_money).group(1)

  33.     print("用户%s,签到后你的积分为%s" % (username, new_money))


  34. def main_handler(event, context):
  35.     return start()


  36. if __name__ == '__main__':
  37.     start()
复制代码
8#
发表于 2019-1-21 08:32:42 | 只看该作者

大佬。你这个好像不行~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-11-1 21:29 , Processed in 0.071918 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表