Hello everyone,
I would like to introduce to you how to download a tiktok video without a logo using Python, the process is as follows:
Get the link to the tiktok video, note that you should use the link on the web, if you get the link on the app, you will get the final link if you access it on your computer.
Get the video ID, the video ID that will be in the link in step 1 is the following parameters /video/
Get Video_id to get video without logo
Download videos to your device
Those are the steps.
Here is the full code:
import requests
import re
headers = {
'referer' : 'https://www.tiktok.com',
'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 OPR/72.0.3815.378',
}
HEADERS = {
'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 OPR/72.0.3815.378',
}
def download(video_url):
vid = re.findall('video\/([0-9]+)',video_url)[0]
base_url = 'https://toolav.herokuapp.com/id/?video_id={}'.format(vid)
data = requests.get(base_url, headers=HEADERS)
base_url = data.json()['item']['playAddr'][0]
req = requests.get(base_url, headers=headers)
with open('{}.mp4'.format(vid),'wb') as fb:
fb.write(req.content)
if __name__=="__main__":
download('https://www.tiktok.com/@tiktok/video/6801895105885195526')
إرسال تعليق