抖音无水印视频下载小工具Python版

抖音无水印视频下载小工具由Python编译而成,支持解析抖音小视频平台下载无水印视频

软件简介

抖音无水印视频下载小工具Python版

软件名称 抖音无水印短视频
软件版本 v1.0
软件类别 视频下载
适用平台 Windows
最近更新 2020.05.11

使用说明

复制抖音内视频分享链接粘贴到抖音无水印短视频软件里下载即可

Python源码

  1. from PySide2.QtWidgets import QApplication, QMessageBox,QFileDialog  
  2. from PySide2.QtUiTools import QUiLoader  
  3. import requests  
  4. import re  
  5. import json  
  6. import os  
  7. from PySide2.QtGui import  QIcon  
  8.    
  9.    
  10. class Download:  
  11.    
  12.     def __init__(self):  
  13.         self.ui = QUiLoader().load('抖音无水印.ui')  
  14.         os.remove('抖音无水印.ui')  
  15.         self.ui.search.clicked.connect(self.find_share)  
  16.         self.ui.search_2.clicked.connect(self.find_hot)  
  17.         self.ui.download.clicked.connect(self.save2)  
  18.         self.ui.download_2.clicked.connect(self.save)  
  19.         self.ui.findpath.clicked.connect(self.findpath)  
  20.         self.path =os.getcwd()  
  21.         self.ui.path.setText(self.path)  
  22.    
  23.     def findpath(self):  
  24.         filePath = QFileDialog.getExistingDirectory(self.ui, "选择存储路径")  
  25.         if filePath == None or filePath == '':  
  26.             pass  
  27.         else:  
  28.             self.path = filePath  
  29.             self.ui.path.setText(self.path)  
  30.    
  31.     def find_share(self):  
  32.         def find_url(share_url):  
  33.             headers = {  
  34.                 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36'}  
  35.             if share_url.find('v.douyin.com') < 0:  
  36.                 return share_url  
  37.             response = requests.get(url=share_url, headers=headers,  
  38.                                     allow_redirects=False)  # allow_redirects = False 不允许跳转  
  39.             url = response.headers['Location']  
  40.             p = re.compile(r"/playwm")  
  41.             url = p.sub('/play', url, count=1)  
  42.             p2 = re.compile(r"/video/(.+?)/")  
  43.             vid = p2.findall(url)[0]  
  44.             headers = {  
  45.                 'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"}  
  46.             api = '''https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={}'''.format(vid)  
  47.             response = requests.get(api, headers=headers)  
  48.             html = response.text  
  49.             data = json.loads(html)  
  50.             video_name = data["item_list"][0]["share_info"]["share_title"]  
  51.             return url, video_name  
  52.    
  53.         def find_play(url):  
  54.             headers = {  
  55.                 'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"}  
  56.             response = requests.get(url, headers=headers)  
  57.             html = response.text  
  58.             p = re.compile(r'playAddr: [\'\"](https.+?)[\'\"]')  
  59.             v_url = p.findall(html)  
  60.             return v_url[0]  
  61.    
  62.         def save_vid(url, name,filePath,ui):  
  63.             p = re.compile(r"/playwm")  
  64.             url = p.sub('/play', url, count=1)  
  65.             headers = {  
  66.                 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36'}  
  67.             response = requests.get(url, headers=headers)  
  68.             r = response.content  
  69.             with open(filePath+r'\{}.mp4'.format(name), 'wb') as f:  
  70.                 f.write(r)  
  71.             QMessageBox.about(self.ui,  
  72.                               '提示',  
  73.                               '{}\n下载完成!'.format(name)  
  74.                               )  
  75.             #ui.url_input.clear()  
  76.         def main(share_url,ui):  
  77.             b = find_url(share_url)  
  78.             url = b[0]  
  79.             name = b[1]  
  80.             play_url = find_play(url)  
  81.             save_vid(play_url, name, self.path,ui)  
  82.    
  83.    
  84.         share_url = self.ui.url_input.toPlainText()  
  85.         p = re.compile(r"(https://v.douyin.com/.+?/)")  
  86.         share_urls = p.findall(share_url)  
  87.         if share_urls == []:  
  88.             QMessageBox.about(self.ui,  
  89.                               '警告',  
  90.                               '并没有找到分享链接\n或者\n分享链接可能有误!'  
  91.                               )  
  92.         else:  
  93.             for i in share_urls:  
  94.                 main(i,self.ui)  
  95.    
  96.     def find_hot(self):  
  97.         url_list = []  
  98.         names_list = []  
  99.         url = 'https://www.iesdouyin.com/web/api/v2/hotsearch/billboard/aweme/'  
  100.         headers = {  
  101.             'uesr-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36',  
  102.             'referer': 'https://www.iesdouyin.com/share/billboard/?id=0&utm_source=copycopy&utm_campaign=client_share&utm_medium=android&share_app_name=douyin'  
  103.         }  
  104.         response = requests.get(url, headers=headers)  
  105.         html = response.text  
  106.         data = json.loads(html)['aweme_list']  
  107.         error = ['/', '"', '\\', '|', '*', '>', '<', ':']  
  108.         for i in data:  
  109.             url = i['aweme_info']['video']["play_addr"]["url_list"][0]  
  110.             url_list.append(url)  
  111.             name = i['aweme_info']['share_info']['share_title']  
  112.             for each in error:  
  113.                 if each in name:  
  114.                     name = name.replace(each, ' ')  
  115.             names_list.append(name)  
  116.         self.url_list = url_list  
  117.         self.names_list = names_list  
  118.         self.ui.listWidget.clear()  
  119.         self.data = {}  
  120.         count = 0  
  121.         for i in self.names_list:  
  122.             self.ui.listWidget.addItem(i)  
  123.             self.data[i] = self.url_list[count]  
  124.             count += 1  
  125.    
  126.    
  127.     def save(self):  
  128.         try:  
  129.             item = self.ui.listWidget.currentItem().text()  
  130.         except:  
  131.             QMessageBox.about(self.ui,  
  132.                               '警告',  
  133.                               '请先查询并选择!!'  
  134.                               )  
  135.         url = self.data[item]  
  136.         headers = {  
  137.             'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36'}  
  138.         response = requests.get(url, headers=headers)  
  139.         r = response.content  
  140.         with open(self.path+r'\{}.mp4'.format(item), 'wb') as f:  
  141.             f.write(r)  
  142.             QMessageBox.about(self.ui,  
  143.                               '提示',  
  144.                               '下载完成!'  
  145.                               )  
  146.    
  147.     def save2(self):  
  148.         try:  
  149.             item = self.ui.listWidget.currentItem().text()  
  150.         except:  
  151.             QMessageBox.about(self.ui,  
  152.                               '警告',  
  153.                               '请先查询并选择!!'  
  154.                               )  
  155.         url = self.data[item]  
  156.         p = re.compile(r"/playwm")  
  157.         url = p.sub('/play', url, count=1)  
  158.         headers = {  
  159.             'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36'}  
  160.         response = requests.get(url, headers=headers)  
  161.         r = response.content  
  162.         with open(self.path+r'\{}.mp4'.format(item), 'wb') as f:  
  163.             f.write(r)  
  164.             QMessageBox.about(self.ui,  
  165.                               '提示',  
  166.                               '下载完成!'  
  167.                               )  
  168.    
  169. png = b'图片的二进制数据'#这个数据我删了,太大了,你可以随便放一个图片的路径就好  
  170. bit_ui = b'ui的二进制数据'#这个UI的数据我也给删掉了,其实就是自己用qt画的,你可以自己随便画一个。  
  171.    
  172. with open('logo_3958666.png', 'wb') as g:  
  173.     g.write(png)  
  174. with open('抖音无水印.ui', 'wb') as f:  
  175.     f.write(bit_ui)  
  176. app = QApplication([])  
  177. app.setWindowIcon(QIcon('logo_3958666.png'))  
  178. os.remove('logo_3958666.png')  
  179. d = Download()  
  180. d.ui.show()  
  181. app.exec_()  

附件下载

附件下载

下载权限

查看
  • 免费下载
    评论并刷新后下载
    登录后下载

查看演示

  • {{attr.name}}:
您当前的等级为
登录后免费下载登录 小黑屋反思中,不准下载! 评论后刷新页面下载评论 支付以后下载 请先登录 您今天的下载次数(次)用完了,请明天再来 支付积分以后下载立即支付 支付以后下载立即支付 您当前的用户组不允许下载升级会员
您已获得下载权限 您可以每天下载资源次,今日剩余
本站 2021-10-01 前所发布文章附件下载地址:https://www.qishe.org/downloads.html
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
搜索