最近时间有点紧,就抓紧时间搜集素材,结果点开一看:VIP可以...,普通用户只能...

所以我做了个Python视频解析器,代码如下:

from urllib import parse
import tkinter.messagebox as msgbox
import tkinter as tk
import webbrowser
import re
class APP:
    def __init__(self, width=500, height=300):
        self.w = width
        self.h = height
        self.title = '网页视频解析器'
        self.root = tk.Tk(className=self.title)
        self.url = tk.StringVar()
        self.v = tk.IntVar()
        self.v.set(1)
        frame_1 = tk.Frame(self.root)
        frame_2 = tk.Frame(self.root)
        group = tk.Label(frame_1, text='解析格式:', padx=10, pady=10)
        tb = tk.Radiobutton(frame_1, text='默认解析格式', variable=self.v, value=1, width=10, height=3)
        lable = tk.Label(frame_2, text='请输入视频链接(支持腾讯、爱奇艺等网站):')
        entry = tk.Entry(frame_2, textvariable=self.url, highlightcolor='Fuchsia', highlightthickness=1, width=35)
        play = tk.Button(frame_2, text='播放', font=('微软雅黑', 9), fg='Black', width=2, height=1, command=self.video_play)
        frame_1.pack()
        frame_2.pack()
        group.grid(row=0, column=0)
        tb.grid(row=0, column=1)
        lable.grid(row=0, column=0)
        entry.grid(row=0, column=1)
        play.grid(row=0, column=3, ipadx=10, ipady=10)

    def video_play(self):
            port = 'https://www.administratorw.com/video.php?url='

            if re.match(r'^https?:/{2}\w.+$', self.url.get()):
                ip = self.url.get()
                ip = parse.quote_plus(ip)
                webbrowser.open(port + ip)
            else:
                msgbox.showerror(title='错误', message='视频地址无效,请重新输入!')
    def loop(self):
            self.root.resizable(True, True)
            self.root.mainloop()
if __name__ == "__main__":
    app = APP()
    app.loop()


本站作者已申明原创,禁止转载!

文章内容属作者个人观点,不代表本站立场,如有侵权立删。

   口袋儿题库-青少儿编程自测题库