• Python实现某音短视频JS XB逆向解析


    哈喽兄弟们,今天来实现一下某音短视频的JS逆向解析。

    知识点

    动态数据抓包`在这里插入代码片`
    requests发送请求
    X-Bogus 参数逆向
    
    • 1
    • 2
    • 3

    环境模块

    python 3.8               运行代码
    pycharm 2022.3           辅助敲代码
    requests                 pip install requests 安装
    
    • 1
    • 2
    • 3

    源码

    获取数据部分

    import requests
    import execjs
     
     
    ctx = execjs.compile(open('xb.js', mode='r', encoding='utf-8').read())
    headers = {
        'referer': 'https://www.改成某音.com/user/MS4wLjABAAAAqsOmrExIsJbZ2b0QLzytzAhAFbJUROH72_yVYM7Zq8E?vid=7273024102460362047',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
    }
    arg1 = 'device_platform=webapp&aid=6383&channel=channel_pc_web&sec_user_id=MS4wLjABAAAAqsOmrExIsJbZ2b0QLzytzAhAFbJUROH72_yVYM7Zq8E&max_cursor=1690869936000&locate_item_id=7273024102460362047&locate_query=false&show_live_replay_strategy=1&need_time_list=1&time_list_query=0&count=18&publish_video_strategy_type=2&pc_client_type=1&version_code=170400&version_name=17.4.0&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=116.0.0.0&browser_online=true&engine_name=Blink&engine_version=116.0.0.0&os_name=Windows&os_version=10&cpu_core_num=6&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=0&webid=7206570248416773684&msToken=kuJ7VXEum5t8MRJsb-EWiKneHuMabLt_Xmvzqjv7Tl92qzTPYaHkfIMCn9ndAkA39d7QfcI57AU353tQuNpAnxbsgxSEXN6KR4Du5bRKUrivq2hBvPiEPaFyW0xyaMc='
    url = 'https://www.改成某音.com/aweme/v1/web/aweme/post/?'
    xb = arg1 + '&X-Bogus=' + ctx.call('window.siyue111', arg1)
    url += xb
    print(url)
    response = requests.get(url, headers=headers)
    json_data = response.json()
    aweme_list = json_data['aweme_list']
    for aweme in aweme_list:
        desc = aweme['desc']
        video_url = aweme['video']['play_addr']['url_list'][0]
        print(desc, video_url)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    JS解密部分太长了,我直接打包了,文末名片领取。
    还录制了详细讲解的视频。

    好了,今天的分享就到这里结束了,下次见!

  • 相关阅读:
    route -n 路由详情
    1.5 空间中的平面与直线
    ROCBOSS开源微社区轻论坛类源码
    第五章 树 1 AcWing 1476. 数叶子结点
    PostgreSQL的视图pg_stat_replication
    100天精通Python(数据分析篇)——第54天:Series对象大总结
    详细给你讲明白JVM发生CMS GC的 5 种情况
    LeetCode:88. 合并两个有序数组
    flink cdc 没有Replication client ,Replication slave权限,报错,处理
    Python3-excel文档操作(四):利用openpyxl库处理excel表格:将数据进行可视化展示在Excel中
  • 原文地址:https://blog.csdn.net/ooowwq/article/details/133825349