mirror of
https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
synced 2025-04-21 23:55:23 +08:00
parent
c6aa9d1476
commit
f0a859961a
@ -2,8 +2,8 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
# @Author: https://github.com/Evil0ctal/
|
# @Author: https://github.com/Evil0ctal/
|
||||||
# @Time: 2021/11/06
|
# @Time: 2021/11/06
|
||||||
# @Update: 2022/12/09
|
# @Update: 2022/12/16
|
||||||
# @Version: 3.1.5
|
# @Version: 3.1.6
|
||||||
# @Function:
|
# @Function:
|
||||||
# 核心代码,估值1块(๑•̀ㅂ•́)و✧
|
# 核心代码,估值1块(๑•̀ㅂ•́)و✧
|
||||||
# 用于爬取Douyin/TikTok数据并以字典形式返回。
|
# 用于爬取Douyin/TikTok数据并以字典形式返回。
|
||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import random
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import platform
|
import platform
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -309,7 +308,7 @@ class Scraper:
|
|||||||
print('正在获取TikTok视频数据...')
|
print('正在获取TikTok视频数据...')
|
||||||
try:
|
try:
|
||||||
# 构造访问链接/Construct the access link
|
# 构造访问链接/Construct the access link
|
||||||
api_url = f'https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id={video_id}&iid=6165993682518218889&device_id={random.randint(10*10*10, 9*10**10)}&aid=1180'
|
api_url = f'https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id={video_id}&aid=1180'
|
||||||
print("正在获取视频数据API: {}".format(api_url))
|
print("正在获取视频数据API: {}".format(api_url))
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(api_url, headers=self.tiktok_api_headers, proxy=self.proxies, timeout=10) as response:
|
async with session.get(api_url, headers=self.tiktok_api_headers, proxy=self.proxies, timeout=10) as response:
|
||||||
@ -390,7 +389,7 @@ class Scraper:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
"User-Agent": self.tiktok_api_headers["User-Agent"],
|
"User-Agent": self.tiktok_api_headers["User-Agent"],
|
||||||
"api_url": f'https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id={video_id}&iid=6165993682518218889&device_id={random.randint(10*10*10, 9*10**10)}&aid=1180'
|
"api_url": f'https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id={video_id}&aid=1180'
|
||||||
},
|
},
|
||||||
'desc': data.get("desc"),
|
'desc': data.get("desc"),
|
||||||
'create_time': data.get("create_time"),
|
'create_time': data.get("create_time"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user