吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2902|回复: 16
收起左侧

[学习记录] 下载抖音

[复制链接]
在外DE孩子 发表于 2024-4-21 12:00
import requests
import json

url='https://www.douyin.com/aweme/v1/web/aweme/post/?device_platform=webapp&aid=6383&channel=channel_pc_web&sec_user_id=MS4wLjABAAAAYMUDUXHxICfldkn385LUKXg7iaO1-X3yrmUT0pKwy4HFdv-oilZx3TKNmvEzSerj&max_cursor=1692439159000&locate_query=false&show_live_replay_strategy=1&need_time_list=0&time_list_query=0&whale_cut_token=&cut_version=1&count=18&publish_video_strategy_type=2&pc_client_type=1&version_code=290100&version_name=29.1.0&cookie_enabled=true&screen_width=2560&screen_height=1440&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=120.0.0.0&browser_online=true&engine_name=Blink&engine_version=120.0.0.0&os_name=Windows&os_version=10&cpu_core_num=24&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=50&webid=7325815406156580378&msToken=Q33MOEgjtqgfCE22aHyxMe4Q1Xud3uNOrYV43VDT9M6S_5ECHKWe2KZqgMrmWsakGoWEdYbKwZzSPqeIMQxlicZh6Vjcb9Z1nhdIIDSVFaBrefJDOlU%3D&a_bogus=Ev8h%2F5hkdifBffyD51OLfY3q61r3Y2LL0trEMD2fhdvUHg39HMOL9exE5fJvhdgjLT%2FAIemjy4haT3nprQ%2FJ81w39W4x%2F2Cpmg00t-P2souS51fetyWmrsJi5vilFee%2F5vV3EQhBqJKcKYbk09o95XHvODrbYrtswyG7GflNv9smPD%3D%3D'

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
           'Cookie': 'ttwid=1%7CTKzG3v2AKaDoI9BakR0OZyIA7aZiI6TT_ZdYAaNdv3M%7C1705674329%7C7c172c714e1698afb7ad09cda4ae1344f724bf0a0b27fefc623c5cc32c8d9ceb; xgplayer_user_id=164397851872; live_use_vvc=%22false%22; n_mh=BheCOPfWeaWGWVjhiMqqbys1bnsa0CnR6XC2GlzoidE; LOGIN_STATUS=1; store-region=cn-hb; store-region-src=uid; __live_version__=%221.1.1.7452%22; douyin.com; device_web_cpu_core=24; device_web_memory_size=8; architecture=amd64; csrf_session_id=48849ada132e1654e26654a86b08f465; passport_csrf_token=5689c6129b794a3ad8cf8c44d3d42a3c; passport_csrf_token_default=5689c6129b794a3ad8cf8c44d3d42a3c; strategyABtestKey=%221713659864.453%22; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Atrue%2C%22volume%22%3A0.5%7D; FORCE_LOGIN=%7B%22videoConsumedRemainSeconds%22%3A180%7D; bd_ticket_guard_client_web_domain=2; passport_assist_user=Cjx2eMk_5JKwsdrsFqlEBilqsyhzzputdMXhotECzz9KOnFT4JqlRcuLPeEemxA2-SusGQ6dAxXxDrUqguoaSgo8DY9vsHvXHkMXi7KtqP7TadevOD4SRvMCOAq40hqgwnnfhyI_bQFjcK2YcgZ06AWjCdKv8TsOBPUk0WZEENGbzw0Yia_WVCABIgEDyY8Tvw%3D%3D; sso_uid_tt=f213f1a20ecf62a7ec4d3a70d1690422; sso_uid_tt_ss=f213f1a20ecf62a7ec4d3a70d1690422; toutiao_sso_user=f4edc5496f2e651091c9bdf50d88d4bc; toutiao_sso_user_ss=f4edc5496f2e651091c9bdf50d88d4bc; sid_ucp_sso_v1=1.0.0-KDcxN2M4MjU1Y2UyY2JhMWY1ZWU0YmIyMjNjMWEwNTJjNzNiZGNmNmMKHwi_36nCswIQ27-RsQYY7zEgDDDu5_7RBTgFQPsHSAMaAmhsIiBmNGVkYzU0OTZmMmU2NTEwOTFjOWJkZjUwZDg4ZDRiYw; ssid_ucp_sso_v1=1.0.0-KDcxN2M4MjU1Y2UyY2JhMWY1ZWU0YmIyMjNjMWEwNTJjNzNiZGNmNmMKHwi_36nCswIQ27-RsQYY7zEgDDDu5_7RBTgFQPsHSAMaAmhsIiBmNGVkYzU0OTZmMmU2NTEwOTFjOWJkZjUwZDg4ZDRiYw; uid_tt=ef6041f158e5e405cf2a9edaf5db5b64; uid_tt_ss=ef6041f158e5e405cf2a9edaf5db5b64; sid_tt=7bb914b47048b603782cc45a12311f48; sessionid=7bb914b47048b603782cc45a12311f48; sessionid_ss=7bb914b47048b603782cc45a12311f48; _bd_ticket_crypt_doamin=2; _bd_ticket_crypt_cookie=28c00c904df075d313917edad31f2a8f; __security_server_data_status=1; sid_guard=7bb914b47048b603782cc45a12311f48%7C1713659872%7C5183998%7CThu%2C+20-Jun-2024+00%3A37%3A50+GMT; sid_ucp_v1=1.0.0-KGM0ZmEyZDgzNGQyNTg5M2JiN2EzZTkyYWMyNDM4Yzk1OWMxM2JiYTkKGQi_36nCswIQ4L-RsQYY7zEgDDgFQPsHSAQaAmhsIiA3YmI5MTRiNDcwNDhiNjAzNzgyY2M0NWExMjMxMWY0OA; ssid_ucp_v1=1.0.0-KGM0ZmEyZDgzNGQyNTg5M2JiN2EzZTkyYWMyNDM4Yzk1OWMxM2JiYTkKGQi_36nCswIQ4L-RsQYY7zEgDDgFQPsHSAQaAmhsIiA3YmI5MTRiNDcwNDhiNjAzNzgyY2M0NWExMjMxMWY0OA; FRIEND_NUMBER_RED_POINT_INFO=%22MS4wLjABAAAA3wT6jGFD-0SqU3i3f2ADJJ22Xs8axvzqm1KfxsG0OXE%2F1713715200000%2F1713660189755%2F0%2F0%22; download_guide=%223%2F20240421%2F0%22; xg_device_score=7.798768640471447; pwa2=%220%7C0%7C3%7C0%22; stream_player_status_params=%22%7B%5C%22is_auto_play%5C%22%3A0%2C%5C%22is_full_screen%5C%22%3A0%2C%5C%22is_full_webscreen%5C%22%3A1%2C%5C%22is_mute%5C%22%3A1%2C%5C%22is_speed%5C%22%3A1%2C%5C%22is_visible%5C%22%3A0%7D%22; __ac_nonce=066246fda00267b4cd34f; __ac_signature=_02B4Z6wo00f012Q6kDQAAIDCbhxLnIT4AGtkGpSAAL827jQk0KGZNVkU.n7DdtDu8aKPQU8th.t6KjMQ7Uz.8Ua2ZPD2s2Ah1GA5ofKC6KzkEdFAW8plm264ALlNOogUYhdR7yQm6or5Er38b0; dy_swidth=2560; dy_sheight=1440; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A2560%2C%5C%22screen_height%5C%22%3A1440%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A24%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A10%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A50%7D%22; IsDouyinActive=true; home_can_add_dy_2_desktop=%221%22; FOLLOW_LIVE_POINT_INFO=%22MS4wLjABAAAA3wT6jGFD-0SqU3i3f2ADJJ22Xs8axvzqm1KfxsG0OXE%2F1713715200000%2F1713660188611%2F0%2F1713664656170%22; FOLLOW_NUMBER_YELLOW_POINT_INFO=%22MS4wLjABAAAA3wT6jGFD-0SqU3i3f2ADJJ22Xs8axvzqm1KfxsG0OXE%2F1713715200000%2F0%2F0%2F1713665256170%22; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCTm9XWkNwbEtMaVhHd3d2cWkzOGpVSUtIVk1XcytYN1dyWlUwaUoxeDlTK05xYWcyeVEvbkdqNkplU1gwOU5PdFd4ZlVMNjBKMkJmWGJsOU5MNkV6ZVU9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ%3D%3D; passport_fe_beating_status=true; publish_badge_show_info=%220%2C0%2C0%2C1713664061159%22; msToken=VSVSiMe4o5HFxJvThAi2WXMtWH9uIR9i3WdEmJHa9wXcmUKyE-EK0YY6xLoOjb7cpfcc4By1idDHgsJ9DLrVtH7fUNHhwCpPhPOLsH6TtjIUGEkrRyY=; odin_tt=8508750852f521a14ffb3ee9a61fc50c8c828e31e91b2588f499c871524062db3625a52cdfbf4339a2a025280d05a8b5',
           'Referer': 'https://www.douyin.com/user/MS4wLjABAAAAYMUDUXHxICfldkn385LUKXg7iaO1-X3yrmUT0pKwy4HFdv-oilZx3TKNmvEzSerj'
}

resp = requests.get(url,headers=headers)

result_list = json.loads(resp.text)

result = result_list['aweme_list']

# print(result)

for i in result[0:17]:
    print(i)
    # 获取url信息
    vedio = i['video']['play_addr']['url_list'][0]
    # 找到title信息
    title = i['desc']
    # 打印相关信息
    print(title, vedio)
    # 获取视频信息
    video_resp = requests.get(vedio, headers=headers)

    with open(f'{title}.mp4', 'wb') as f:

        f.write(video_resp.content)


image.png
image.png
image.png

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

wapjltyhm 发表于 2024-4-21 12:28
这是下载抖音视频的么?
鬼话 发表于 2024-4-21 12:42
 楼主| 在外DE孩子 发表于 2024-4-21 12:49
wfghim 发表于 2024-4-21 12:54
感觉是一次性的接口
pdawg00 发表于 2024-4-21 12:56
抖音浏览器里F12 就能下载视频。
hxddzgf 发表于 2024-4-21 13:02
抖音喜欢的喜欢得不得了,不喜欢的超级讨厌铺天盖地的推广。
wakichie 发表于 2024-4-21 13:30
分享下成品大佬
myconan 发表于 2024-4-21 14:48
hxddzgf 发表于 2024-4-21 13:02
抖音喜欢的喜欢得不得了,不喜欢的超级讨厌铺天盖地的推广。

抖音小姐姐多吗?
zsf123 发表于 2024-4-21 16:08
看不懂,有成品吗?大神
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

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

GMT+8, 2024-12-12 10:35

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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