吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1001|回复: 3
上一主题 下一主题
收起左侧

[求助] 网易云逆向学习求助大佬

[复制链接]
跳转到指定楼层
楼主
ljhsg 发表于 2024-4-6 13:25 回帖奖励
学了python有一段时间,想进阶一下技术,b站看了网易云逆向下载歌的视频https://www.bilibili.com/video/BV13w411A7C5/?spm_id_from=333.1007.top_right_bar_window_default_collection.content.click
我想拓展一下,把我歌单刷一下满足一下虚荣心,于是跟着视频一步一步得到加密方式,当我拿到post请求所需的加密方式,按照对于的网址发请求后,成功得到返回值200,但是播放量并没有增加

在浏览器手动点击播放全部,会立即增加一次,但是只有一次生效刷新几次页面重复操作之后,不生效,
随后采取新的方案:用代{过}{滤}理ip多线程模拟请求从刷新歌单页面到点击播放的所有post请求都发送一遍。播放量增加了,但是十几分钟有效的播放次数只增加了4,5次,感觉都在做无用功
各位大佬看看代码有什么要改进的地方,怀疑user-Agent随机生成,可能和post发送固定的ua有冲突,但没有证据,因为既然播放次数有效应该不是主要的问题吧
[Python] 纯文本查看 复制代码
import random
import time
import requests
import execjs
from fake_useragent import UserAgent
from concurrent.futures import ThreadPoolExecutor

executor = ThreadPoolExecutor(max_workers=4)
headers1 = {
    'User-Agent': "",     #random.choice(my_headers)
    'Referer': 'https://music.163.com/',
    'Host': 'music.163.com',
    "Nm-Gcore-Status":"1",
    "Priority": "u=1, i",
    "Cookie":'os=pc; osver=Microsoft-Windows-10-Professional-build-10586-64bit; appver=2.0.3.131777; channel=netease; __remember_me=true;'
}
proxy_list = []
with open('../ok_ip.txt', 'r') as f:
    for line in f.readlines():
        proxy_list.append(line.strip())
def fetch_data(current_ip):
    def post_web(imp, url):
        file = open('./wyy.js', "r").read()
        js_res = execjs.compile(file)
        params_seckey = js_res.call('asrseaDict', imp)
        data = {
            "params": params_seckey['encText'],
            "encSecKey": params_seckey["encSecKey"]
        }
        response = session.post(url=url, headers=headers1, data=data, timeout=4).content
        # response = requests.post(url=url, headers=headers1,data=data,timeout=4).content
        print(f"POST:{url}\nRESPONSE:{response}")
        return response
    print("当前ip:", current_ip)
    proxy = {"http": current_ip}
    headers1["User-Agent"] = UserAgent().random
    session = requests.Session()  # 创建一个session对象
    # 1
    d1 = str({"csrf_token":""})
    url1 = "https://music.163.com/weapi/cdns?csrf_token="
    res1 = post_web(d1,url1)

    # 2
    url2 = "https://music.163.com/weapi/privacy/info/get/v2?csrf_token="
    res2 = post_web(d1,url2)
    # 3
    url3 = "https://music.163.com/weapi/copyright/pay_fee_message/config?csrf_token="
    res3 = post_web(d1, url3)
    # 4
    url4 = "https://music.163.com/weapi/event/user/permission?csrf_token="
    res4 = post_web(d1, url4)

    # 5
    url5 = "https://music.163.com/weapi/privilege/message/mv?csrf_token="
    res5 = post_web(d1, url5)
    # 6
    actionweb = '{"logs\":\"[{\\\"action\\\":\\\"activeweb\\\",\\\"json\\\":{\\\"is_organic\\\":1,\\\"url\\\":\\\"https://music.163.com/#/playlist?id=9607318306&userid=605780865\\\",\\\"mainsite\\\":\\\"1\\\"}}]\",\"csrf_token\":""}'
    mobile_monitor = {"logs": "[{\"action\":\"mobile_monitor\",\"json\":{\"meta._ver\":2,\"meta._dataName\":\"pip_lyric_monitor\",\"action\":\"render\",\"userAgent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\",\"chromeVersion\":124,\"resourceId\":2139063352,\"resourceType\":\"song\",\"mainsite\":\"1\"}}]","csrf_token": ""}
    weblog = "https://music.163.com/weapi/feedback/weblog?csrf_token="
    res6 = post_web(actionweb, weblog)

    get_url = "https://music.163.com/m/api/encryption/param/get?csrf_token="
    get_res = requests.get(url=get_url, headers=headers1,timeout=4).content

    # 7
    d7 = "{\"moduleName\":\"preload\",\"csrf_token\":\"\"}"
    url7 = "https://music.163.com/weapi/middle/clientcfg/config/list?csrf_token="
    res7 = post_web(d7, url7)
    # 8
    res8 = post_web(d7, url7)
    # 9
    # d9 = {"logs":"[{\"action\":\"mobile_monitor\",\"json\":{\"meta._ver\":2,\"meta._dataName\":\"pip_lyric_monitor\",\"action\":\"impress\",\"userAgent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\",\"chromeVersion\":124,\"mainsite\":\"1\"}}]","csrf_token":""}
    res6 = post_web(mobile_monitor, weblog)
    res6 = post_web(mobile_monitor, weblog)

    # 10
    d10 = {"id":2139063352,"lv":-1,"tv":-1,"csrf_token":""}
    url10 = "https://music.163.com/weapi/song/lyric?csrf_token="
    res10 = post_web(d10, url10)

    # 11
    d11 = {"rid":"A_PL_0_9607318306","threadId":"A_PL_0_9607318306","pageNo":"1","pageSize":"20","cursor":"-1","offset":"0","orderType":"1","csrf_token":""}
    url11 = "https://music.163.com/weapi/comment/resource/comments/get?csrf_token="
    res11 = post_web(d11, url11)

    res6 = post_web(mobile_monitor, weblog)

    # 12
    d12 = {"ids":"[2139063352]","level":"standard","encodeType":"aac","csrf_token":""}
    url12 = "https://music.163.com/weapi/song/enhance/player/url/v1?csrf_token="
    res12 = post_web(d12, url12)
    time.sleep(2)

    # 13
    res12 = post_web(d12, url12)

    # 14
    startplay = {"logs":"[{\"action\":\"startplay\",\"json\":{\"id\":2139063352,\"type\":\"song\",\"content\":\"id=9607318306&userid=605780865\",\"mainsite\":\"1\"}}]","csrf_token":""}
    res14 = post_web(startplay, weblog)
    play = {"logs":"[{\"action\":\"play\",\"json\":{\"id\":\"9607318306\",\"type\":\"list\",\"mainsite\":\"1\",\"content\":\"id=9607318306&userid=605780865\"}}]","csrf_token":""}
    res14 = post_web(play, weblog)

    # 15
    d15 = {"id":"9607318306","csrf_token":""}
    url222 = "https://music.163.com/weapi/playlist/update/playcount?csrf_token="
    res15 = post_web(d15, url222)

    res_weblog = post_web(mobile_monitor, weblog)
    # 16p[
    url_16 = "https://music.163.com/weapi/activity/p2p/flow/switch/get?csrf_token="
    res16 = post_web(d1, url_16)


with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:  # 设置最大线程数
    futures = {executor.submit(fetch_data, ip): ip for ip in proxy_list}
    for future in concurrent.futures.as_completed(futures):
        ip = futures[future]
        try:
            future.result()  # 获取并处理每个线程的结果(如果有的话)
        except Exception as exc:
            print(f"线程中出现错误:{exc}, 当前使用的IP: {ip}")

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

沙发
 楼主| ljhsg 发表于 2024-4-6 18:08 |楼主
quiet0 发表于 2024-4-6 16:24
120行已经是有想法的人了

逆向还是小白阶段哈哈哈
3#
kittylang 发表于 2024-4-6 20:10
4#
 楼主| ljhsg 发表于 2024-4-6 20:23 |楼主
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

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

GMT+8, 2024-12-15 12:33

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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