2022年-抖音最新去水印解析脚本Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: chuxia
@contact: 676463@qq.com
@blog: https://qq.cool
@file: dy.py
@time: 2022/4/16 9:50 上午
'''
import requests


class Douyin:
    s = requests.Session()
    s.headers.update({
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
    })

    def __init__(self, url: str):
        self.url = url

    def run(self):
        res = self.s.get(self.url).url
        ids = res.split('video/')[1].split('?')[0]
        self.ids = ids
        self.getVideoInfo()

    def getVideoInfo(self):
        res = self.s.get('https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=' + self.ids).json()
        print(
            res['item_list'][0]['video']['play_addr']['url_list'][0].replace('playwm', 'play').replace('720p', '9999'))


url = 'https://v.douyin.com/NT4n1H8/ '
dy = Douyin(url)
dy.run()

原文来自于https://qq.cool/post/48.html

相关文章

× « »