抖音无水印视频下载小工具由Python编译而成,支持解析抖音小视频平台下载无水印视频
软件简介
软件名称 | 抖音无水印短视频 |
---|---|
软件版本 | v1.0 |
软件类别 | 视频下载 |
适用平台 | Windows |
最近更新 | 2020.05.11 |
使用说明
复制抖音内视频分享链接粘贴到抖音无水印短视频软件里下载即可
Python源码
- from PySide2.QtWidgets import QApplication, QMessageBox,QFileDialog
- from PySide2.QtUiTools import QUiLoader
- import requests
- import re
- import json
- import os
- from PySide2.QtGui import QIcon
- class Download:
- def __init__(self):
- self.ui = QUiLoader().load('抖音无水印.ui')
- os.remove('抖音无水印.ui')
- self.ui.search.clicked.connect(self.find_share)
- self.ui.search_2.clicked.connect(self.find_hot)
- self.ui.download.clicked.connect(self.save2)
- self.ui.download_2.clicked.connect(self.save)
- self.ui.findpath.clicked.connect(self.findpath)
- self.path =os.getcwd()
- self.ui.path.setText(self.path)
- def findpath(self):
- filePath = QFileDialog.getExistingDirectory(self.ui, "选择存储路径")
- if filePath == None or filePath == '':
- pass
- else:
- self.path = filePath
- self.ui.path.setText(self.path)
- def find_share(self):
- def find_url(share_url):
- headers = {
- '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'}
- if share_url.find('v.douyin.com') < 0:
- return share_url
- response = requests.get(url=share_url, headers=headers,
- allow_redirects=False) # allow_redirects = False 不允许跳转
- url = response.headers['Location']
- p = re.compile(r"/playwm")
- url = p.sub('/play', url, count=1)
- p2 = re.compile(r"/video/(.+?)/")
- vid = p2.findall(url)[0]
- headers = {
- '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"}
- api = '''https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={}'''.format(vid)
- response = requests.get(api, headers=headers)
- html = response.text
- data = json.loads(html)
- video_name = data["item_list"][0]["share_info"]["share_title"]
- return url, video_name
- def find_play(url):
- headers = {
- '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"}
- response = requests.get(url, headers=headers)
- html = response.text
- p = re.compile(r'playAddr: [\'\"](https.+?)[\'\"]')
- v_url = p.findall(html)
- return v_url[0]
- def save_vid(url, name,filePath,ui):
- p = re.compile(r"/playwm")
- url = p.sub('/play', url, count=1)
- headers = {
- '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'}
- response = requests.get(url, headers=headers)
- r = response.content
- with open(filePath+r'\{}.mp4'.format(name), 'wb') as f:
- f.write(r)
- QMessageBox.about(self.ui,
- '提示',
- '{}\n下载完成!'.format(name)
- )
- #ui.url_input.clear()
- def main(share_url,ui):
- b = find_url(share_url)
- url = b[0]
- name = b[1]
- play_url = find_play(url)
- save_vid(play_url, name, self.path,ui)
- share_url = self.ui.url_input.toPlainText()
- p = re.compile(r"(https://v.douyin.com/.+?/)")
- share_urls = p.findall(share_url)
- if share_urls == []:
- QMessageBox.about(self.ui,
- '警告',
- '并没有找到分享链接\n或者\n分享链接可能有误!'
- )
- else:
- for i in share_urls:
- main(i,self.ui)
- def find_hot(self):
- url_list = []
- names_list = []
- url = 'https://www.iesdouyin.com/web/api/v2/hotsearch/billboard/aweme/'
- headers = {
- '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',
- 'referer': 'https://www.iesdouyin.com/share/billboard/?id=0&utm_source=copycopy&utm_campaign=client_share&utm_medium=android&share_app_name=douyin'
- }
- response = requests.get(url, headers=headers)
- html = response.text
- data = json.loads(html)['aweme_list']
- error = ['/', '"', '\\', '|', '*', '>', '<', ':']
- for i in data:
- url = i['aweme_info']['video']["play_addr"]["url_list"][0]
- url_list.append(url)
- name = i['aweme_info']['share_info']['share_title']
- for each in error:
- if each in name:
- name = name.replace(each, ' ')
- names_list.append(name)
- self.url_list = url_list
- self.names_list = names_list
- self.ui.listWidget.clear()
- self.data = {}
- count = 0
- for i in self.names_list:
- self.ui.listWidget.addItem(i)
- self.data[i] = self.url_list[count]
- count += 1
- def save(self):
- try:
- item = self.ui.listWidget.currentItem().text()
- except:
- QMessageBox.about(self.ui,
- '警告',
- '请先查询并选择!!'
- )
- url = self.data[item]
- headers = {
- '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'}
- response = requests.get(url, headers=headers)
- r = response.content
- with open(self.path+r'\{}.mp4'.format(item), 'wb') as f:
- f.write(r)
- QMessageBox.about(self.ui,
- '提示',
- '下载完成!'
- )
- def save2(self):
- try:
- item = self.ui.listWidget.currentItem().text()
- except:
- QMessageBox.about(self.ui,
- '警告',
- '请先查询并选择!!'
- )
- url = self.data[item]
- p = re.compile(r"/playwm")
- url = p.sub('/play', url, count=1)
- headers = {
- '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'}
- response = requests.get(url, headers=headers)
- r = response.content
- with open(self.path+r'\{}.mp4'.format(item), 'wb') as f:
- f.write(r)
- QMessageBox.about(self.ui,
- '提示',
- '下载完成!'
- )
- png = b'图片的二进制数据'#这个数据我删了,太大了,你可以随便放一个图片的路径就好
- bit_ui = b'ui的二进制数据'#这个UI的数据我也给删掉了,其实就是自己用qt画的,你可以自己随便画一个。
- with open('logo_3958666.png', 'wb') as g:
- g.write(png)
- with open('抖音无水印.ui', 'wb') as f:
- f.write(bit_ui)
- app = QApplication([])
- app.setWindowIcon(QIcon('logo_3958666.png'))
- os.remove('logo_3958666.png')
- d = Download()
- d.ui.show()
- app.exec_()
附件下载
附件下载
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。