吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 5237|回复: 8
收起左侧

[Python 转载] 快手无水印视频解析

[复制链接]
cdsgg 发表于 2021-5-8 13:19
[Python] 纯文本查看 复制代码
import requests
import re





def AccessToRedirect(url,h):

    url = 'https://v.kuaishou.com/'+re.findall('https://v.kuaishou.com/([a-zA-Z0-9]+)',url)[0]

    r = requests.get(url, headers=h)
    location = r.url.split('?')[0].split('/')[-1]
    return location

def ForWithoutWatermark(location,h):
    url='https://video.kuaishou.com/graphql'

    data={"operationName":"visionVideoDetail","variables":{"photoId":location,"page":"detail"},"query":"query visionVideoDetail($photoId: String, $type: String, $page: String, $webPageArea: String) {\n  visionVideoDetail(photoId: $photoId, type: $type, page: $page, webPageArea: $webPageArea) {\n    status\n    type\n    author {\n      id\n      name\n      following\n      headerUrl\n      __typename\n    }\n    photo {\n      id\n      duration\n      caption\n      likeCount\n      realLikeCount\n      coverUrl\n      photoUrl\n      liked\n      timestamp\n      expTag\n      llsid\n      viewCount\n      videoRatio\n      stereoType\n      croppedPhotoUrl\n      manifest {\n        mediaType\n        businessType\n        version\n        adaptationSet {\n          id\n          duration\n          representation {\n            id\n            defaultSelect\n            backupUrl\n            codecs\n            url\n            height\n            width\n            avgBitrate\n            maxBitrate\n            m3u8Slice\n            qualityType\n            qualityLabel\n            frameRate\n            featureP2sp\n            hidden\n            disableAdaptive\n            __typename\n          }\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    tags {\n      type\n      name\n      __typename\n    }\n    commentLimit {\n      canAddComment\n      __typename\n    }\n    llsid\n    __typename\n  }\n}\n"}

    r=requests.post(url,json=data,headers=h).json()

    return r['data']['visionVideoDetail']['photo']['photoUrl'].split("&tt")[0]





if __name__ == '__main__':
    headers = {
        "Cookie": "填写你自己的cookie就可以了",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0"
    }
    strcontent=input('请输入分享链接:')
    locat=AccessToRedirect(strcontent, headers)
    print("无水印视频链接:"+ForWithoutWatermark(locat, headers))
1.png

免费评分

参与人数 1热心值 +1 收起 理由
pentium315 + 1 我很赞同!

查看全部评分

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

yhx5773489 发表于 2021-5-8 13:33
感谢楼主分享
pentium315 发表于 2021-5-8 13:34
gztf 发表于 2021-5-8 13:43
liufyan 发表于 2021-5-8 14:05
刚需,谢谢LZ
女王约我来巡山 发表于 2021-5-8 14:10
不错的,感谢分享
xiaoxuan510 发表于 2022-2-11 19:40
这个实实在在哦
guzhou 发表于 2022-2-16 14:45
感谢分享,送花花
Galaxy2010 发表于 2022-2-17 11:20
不错啊,抖音的有吗?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

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

GMT+8, 2024-11-25 08:20

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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