首页 编程教程正文

【分享】异步社区自动做任务

piaodoo 编程教程 2020-02-22 22:01:01 962 0 python教程

本文来源吾爱破解论坛

本帖最后由 q59541511 于 2018-9-9 21:00 编辑

0x0001 分析异步社区各项任务发起请求


登录+5

功能:签到+5
链接:https://www.epubit.com/points/sign
请求方式:get



功能:阅读文章+5
链接:https://www.epubit.com/points/read
请求方式:post
参数:
activeCode:1
objectId:f180197f-af12-4819-aa13-3551db7cdf09
activeDescription:分享:<<图书名>>(可不添加)


功能:点赞文章+5
链接:https://www.epubit.com/selfpublish/like
请求方式post
参数:
bookId:f180197f-af12-4819-aa13-3551db7cdf09
memberPortalId:12c61401-6d3a-438c-910b-af00b2bd6f9a(用户ID)


功能:分享文章+10
链接:https://www.epubit.com/points/read
请求方式:post
参数:
activeCode:3
objectId:f180197f-af12-4819-aa13-3551db7cdf09
activeDescription:分享:<<图书名>>(可不添加)



功能:阅读图书+5
链接:https://www.epubit.com/points/read
请求方式:post
activeCode:2
objectId:A707FE7E-8283-4283-BB7A-93C134FC5D16
activeDescription:阅读:<<图书名>>(可不添加)


功能:点赞一本书5+
链接:https://www.epubit.com/book/like
请求方式post
参数:
bookId:F0A82CF9-57DB-422C-B859-FBB2646D663D
memberPortalId:12c61401-6d3a-438c-910b-af00b2bd6f9a(用户ID)


功能:分享图书+10
链接:https://www.epubit.com/points/read
请求方式:post
参数:
activeCode:4
objectId:A707FE7E-8283-4283-BB7A-93C134FC5D16
activeDescription:分享:<<图书名>>(可不添加)

0x0002 项目需求解析

1.需要书籍Id 自己采集.(我这边已经采集了所有的书籍ID)
2.每次任务需要进行请求阅读不同的书籍
3.图像验证.(我这边就使用第三方验证打码平台) 等收集到足够的样本使用tensorflow训练

0x0003 编写代码实现自动登录打码以及读书任务

[Python] 纯文本查看 复制代码

#!/usr/bin/evt python
import requests
import json
import re
import configparser
import time

def test_code(api_username, api_password, file_bytes, api_post_url, yzm_min, yzm_max, yzm_type, tools_token):
    # api_username =
    # api_password =
    # file_name = 'c:/temp/lianzhong_vcode.png'
    # api_post_url = "http://v1-http-api.jsdama.com/api.php?mod=php&act=upload"
    # yzm_min = '5'
    # yzm_max = '5'
    # yzm_type = '1001'
    tools_token = 'q59541511'

    # proxies = {'http': 'http://127.0.0.1:8888'}
    headers = {
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
        'Accept-Encoding': 'gzip, deflate',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0',
        # 'Content-Type': 'multipart/form-data; boundary=---------------------------227973204131376',
        'Connection': 'keep-alive',
        'Host': 'v1-http-api.jsdama.com',
        'Upgrade-Insecure-Requests': '1'
    }

    files = {
        'upload': ('a.jpg',file_bytes, 'image/png')
    }

    data = {
        'user_name': api_username,
        'user_pw': api_password,
        'yzm_minlen': yzm_min,
        'yzm_maxlen': yzm_max,
        'yzmtype_mark': yzm_type,
        'zztool_token': tools_token
    }
    s = requests.session()
    # r = s.post(api_post_url, headers=headers, data=data, files=files, verify=False, proxies=proxies)
    r = s.post(api_post_url, headers=headers, data=data, files=files, verify=False)
    params=r.text
    print(params)
    return params




def login(user):
    '''
    yibu_login
    :param user:
    :return: session
    '''
    headers={
        'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
        'Referer':'https://www.epubit.com/login',
    }
    session = requests.session()
    session.headers.update(headers)
    session.get('https://www.epubit.com/login',headers=headers)
    response = session.get('https://www.epubit.com/kaptcha.jpg',headers=headers)
    img = response.content
    code = test_code('联众帐号','联众密码',img,'http://v1-http-api.jsdama.com/api.php?mod=php&act=upload','5','5','1001') #这里一定要填写清楚不然不能进行打码
    code = json.loads(code)
    
    #code = input()
    with open('./Imgs/'+code['data']['val']+'.jpg','wb') as f:
        f.write(img)
    #我这里将验证码全部下载下来了方便以后制作识别库
    data={
        'username':user,
        'password':'asd123456', #这里一定要写你帐号的密码一般我都定义成一样
        'verifyCode':code['data']['val'],
        'rememberMe':'false'
    }
    session.post('https://www.epubit.com/login',headers=headers,data=data)
    return session

def yibu_sign(session):
    '''
    yibu_sign
    :param header:
    :return:
    '''
    session.post('https://www.epubit.com/points/sign')


def getUserid(session):
    response = session.get('https://www.epubit.com/')
    Regex = re.compile('var userId = \'' + '(.*?)' + '\';', re.S)
    idlist = Regex.findall(response.text)
    return idlist[0]


def yibu_do_read(session,txtid,bookid):
    for a in range(1,5):
        if a%2==0:
            data = {
                'activeCode': str(a),
                'objectId': bookid,
            }
            response = session.post('https://www.epubit.com/points/read', data=data)
            print(response.text)
        else:
            data = {
                'activeCode': str(a),
                'objectId': txtid,
            }
            response= session.post('https://www.epubit.com/points/read', data=data)
            print(response.text)


def likebook(session,userid,bookid):
    data={
        'bookId':bookid,
        'memberPortalId':userid
    }
    response= session.post('https://www.epubit.com/book/like',data=data)
    print(response.text)

def liketxt(session,userid,txtid):
    data={
        'selfPublishId': txtid,
        'memberPortalId': userid
    }
    response=session.post('https://www.epubit.com/selfpublish/like',data=data)
    print(response.text)

def gettxtandbook(number):
    filetxt = open('./yibu_txt.txt', 'r')
    txt = filetxt.read().splitlines()
    filebook = open('./yibu_book.txt', 'r')
    book = filebook.read().splitlines()
    txtandbook=(txt[number],book[number])
    return txtandbook

def getconfignumber():
    config=configparser.ConfigParser()
    config.read("./config.ini", encoding="utf-8-sig")
    number=int(config.get("config","number"))
    return number

def Change_Config(number):
    print('Do_New_Task'+str(number))
    cf=configparser.ConfigParser()
    cf.read('./config.ini')
    cf.set('config','number',str(number+1))
    cf.write(open('./config.ini','w'))
    print('[yibu]OK:'+str(number+1))


def yibu_login_do_task(txt,book,user):
    session = login(user)
    Userid=getUserid(session)


    yibu_sign(session)
    time.sleep(1)
    yibu_do_read(session,txt,book)
    time.sleep(1)
    likebook(session,Userid,book)
    time.sleep(1)
    liketxt(session,Userid,txt)
    session.cookies.clear()

userid=[
    '132548487487', #这里是你需要进行读书任务的手机号
]

if __name__ == '__main__':
    number = getconfignumber()
    bookandtxt = gettxtandbook(number)
    for i in userid:
        yibu_login_do_task(bookandtxt[0], bookandtxt[1],i)

    Change_Config(number)





0x0004 这玩意有啥用?
积分可以兑换异步社区的任何书籍.达到刷书的目的 嗨学网

Task.rar

2018-9-9 20:58 上传

点击文件名下载附件

下载积分: 吾爱币 -1 CB

58.08 KB, 下载次数: 47, 下载积分: 吾爱币 -1 CB

版权声明:

本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。

有关影视版权:本站只供百度云网盘资源,版权均属于影片公司所有,请在下载后24小时删除,切勿用于商业用途。本站所有资源信息均从互联网搜索而来,本站不对显示的内容承担责任,如您认为本站页面信息侵犯了您的权益,请附上版权证明邮件告知【754403226@qq.com】,在收到邮件后72小时内删除。本文链接:https://www.piaodoo.com/7295.html

搜索