抖音去水印源码Python版

shmily 649 百度已收录 0

代码来源吾爱破解论坛。[doge]

import re
 
import requests, json
 
url = 'https://v.douyin.com/JB7VyAw/'
api = 'https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='
 
header = {
    'user-agent': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7'
}
 
 
def video_url():
    url = input("输入抖音链接:")
    bdurl = r"http?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
    url = re.findall(bdurl, url)
 
    text = requests.get(url[0], headers=header)
 
    ress = r'''(?<=share/video/).*(?=/)'''
    res = re.findall(ress, text.url)
 
    id_url = api + res[0]
    urls = requests.get(id_url,headers=header)
 
 
    videos = urls.json()['item_list'][0]['video']['play_addr']['url_list']
 
    wat = videos[0].replace('wm','')    # 去水印后地址
    print(wat)
    t = requests.get(wat,headers=header).content
    with open('就是刚刚的抖音.mp4','wb') as data_file:
        data_file.write(t)
        input('获取成功!按回车退出........')
 
    #print(t.text)
 
video_url()

发表评论 取消回复
表情 代码

分享