吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 5837|回复: 17
收起左侧

[Python 转载] 【分享】异步社区自动做任务

  [复制链接]
q59541511 发表于 2018-9-9 18:50
本帖最后由 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

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

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

振翅而飞 发表于 2018-10-21 09:18
{"data":null,"msg":"疑似刷积分行为,不加积分","success":true}
{"data":null,"msg":"疑似刷积分行为,不加积分","success":true}
{"data":null,"msg":"疑似刷积分行为,不加积分","success":true}
{"data":null,"msg":"疑似刷积分行为,不加积分","success":true}
{"data":{"res":"操作成功,积分+5","likeCount":12},"msg":"返回数据成功!","success":true}
{"data":{"res":"操作成功,积分+5","likeCount":14},"msg":"返回数据成功!","success":true}
Do_New_Task20
[yibu]OK:21

这是被河蟹了吗?
头像被屏蔽
小白源码资源526 发表于 2018-9-9 19:32
狸追 发表于 2018-9-9 19:07
安699 发表于 2018-9-9 19:08
感谢分享。
 楼主| q59541511 发表于 2018-9-9 19:22

使用方法。。看源码。把信息填写上就行了
E式丶男孩 发表于 2018-9-9 20:12
很好的Python源码,学习了,感谢楼主
小俊俊呀 发表于 2018-9-9 20:29
这能干什么?
 楼主| q59541511 发表于 2018-9-9 20:57

全自动撸书。。积分兑换各种书籍
yvhkchao 发表于 2018-9-9 21:14
异步社区是什么类型的,没听过。孤陋寡闻了。。。。
小楠 发表于 2018-9-9 21:34
要不试试aiohttp模块?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-1 07:30

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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