追剧小工具
正文:
基于Python Tkinter 库编写的本地小工具 —— VIP免费追剧助手。说白了就是通过调用第三方视频解析接口,只不过用python包装了一下实现了免费观看的效果。
核心功能:
1.手动输入解析:将任意爱奇艺、腾讯、优酷等平台的视频详情页链接粘贴到输入框,点击“播放VIP视频”,程序会自动拼接解析接口并调用系统默认浏览器打开播放。
2.快捷直达入口:界面内置了“爱奇艺”、“腾讯视频”、“优酷视频”三个按钮,点击即可快速跳转官网,方便你复制链接。
3.友好的交互反馈:底部状态栏会实时提示操作状态(成功、清空或报错),避免了用户等待时的焦虑感。
完整代码(可直接运行):
import tkinter as tk
import webbrowser
class VIPVideoApp:
def __init__(self, root):
self.root = root
self.root.title('VIP免费追剧')
self.root.geometry('480x200')
self.root.resizable(False, False) # 禁止调整窗口大小
self.create_widgets()
def create_widgets(self):
# 输入框标签
label_movie_link = tk.Label(self.root, text='输入视频地址:')
label_movie_link.place(x=20, y=30, width=100, height=30)
# 输入框(用于存放视频链接)
self.entry_movie_link = tk.Entry(self.root)
self.entry_movie_link.place(x=120, y=30, width=260, height=30)
# 清空按钮
button_clear = tk.Button(self.root, text='清空', command=self.empty)
button_clear.place(x=390, y=30, width=60, height=30)
# 平台快捷按钮
button_iqy = tk.Button(self.root, text='爱奇艺', command=self.open_iqiyi)
button_iqy.place(x=25, y=80, width=80, height=40)
button_tx = tk.Button(self.root, text='腾讯视频', command=self.open_tx)
button_tx.place(x=115, y=80, width=80, height=40)
button_yk = tk.Button(self.root, text='优酷视频', command=self.open_youku)
button_yk.place(x=205, y=80, width=80, height=40)
# VIP 解析播放按钮
button_play = tk.Button(self.root, text='播放VIP视频', command=self.play_video)
button_play.place(x=300, y=80, width=125, height=40)
# 状态提示标签(红色醒目)
self.lab_remind = tk.Label(self.root, text='输入链接后点击播放', fg='red', font=('Arial', 12))
self.lab_remind.place(x=50, y=150, width=380, height=30)
# 打开爱奇艺官网
def open_iqiyi(self):
webbrowser.open('https://www.iqiyi.com')
# 打开腾讯视频官网
def open_tx(self):
webbrowser.open('https://v.qq.com')
# 打开优酷官网
def open_youku(self):
webbrowser.open('https://www.youku.com')
# VIP 解析播放(使用第三方解析接口)
def play_video(self):
video_url = self.entry_movie_link.get().strip()
if not video_url:
self.lab_remind.config(text='请先输入视频链接!', fg='red')
return
# 可选多个解析接口,这里使用其中一种
webbrowser.open('https://jx.m3u8.tv/jiexi/?url=' + video_url)
self.lab_remind.config(text='正在解析播放,请稍候...', fg='green')
# 清空输入框
def empty(self):
self.entry_movie_link.delete(0, 'end')
self.lab_remind.config(text='已清空', fg='blue')
if __name__ == '__main__':
root = tk.Tk()
app = VIPVideoApp(root)
root.mainloop()免责声明: 工具仅供技术学习和交流使用,解析接口来源于第三方平台。请尊重版权,支持正版影视内容。