子比主题自动签到脚本

登录子比主题签到站点,确保已经登录,使用谷歌Google Chrome浏览器为例按下F12开发者工具,点到Application(应用),选择Cookies对应网站的wordpress_logged_in_XXXXXXX,右边的值

import requests
import urllib3
import json
# Disable the warning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

check_list = [
    {'host':'https://www.xxx.cn','cookie_key':'wordpress_logged_in_xxxx','cookie_value':'your_cookie'},
    # {'host':'你签到的网站','cookie_key':'网站cookie的key','cookie_value':'网站cookie的value'},
    ]


for check_info in check_list:
    if check_info:
        try:
            target_host = check_info['host']
            cookie_key = check_info['cookie_key']
            cookie_value = check_info['cookie_value']
            cookies = {
                f'{cookie_key}': f'{cookie_value}',
            }
            headers = {
                'X-Requested-With': 'XMLHttpRequest',
                'User-Agent': 'Mozilla/1.0 (Windows NT 10.0; Win64; x64) AppleWebKit/597.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/538.36',
                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            }
            data = {
                'action': 'user_checkin',
            }
            response = requests.post(f'{target_host}/wp-admin/admin-ajax.php', cookies=cookies, headers=headers, data=data, verify=False)
            json_data = json.loads(response.text)
            print(f'[+]{target_host}---->{json_data["msg"]}')
        except:
            print(f"[-]{check_info['host']}---->签到失败")

定时任务task 文件名.py

THE END
喜欢就支持一下吧
点赞7赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    请登录后查看评论内容