Project combat Python whole network viewing free membership, VIP large free look

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/suoyue_py/article/details/100067603

Python teach you how to open the correct viewing posture

Watching films but also with VIP, did not want to open membership, how do? ? ?
Here Insert Picture Description
Python movie with knock cracked version of small projects, from watching films no longer have to buy members> _ <
Here Insert Picture Description
As more knowledge to use, involving knowledge points to provide insights, relevant knowledge to provide learning linked
to import the required libraries :

import tkinter as tk        #导入Python的标准GUI库:做图形用户界面的
import tkinter.messagebox as msgbox     #导入对话框模块:当程序运行错误时,将错误以弹窗的形式告诉用户
import re           #正则表达式 判断用户输入的网址是否有误
from urllib import parse        #url 编码包
import webbrowser           #控制浏览器的包 当用户点击了播放的时候 会调用webbrower 自动的去启动浏览器

GUI with Python's standard library: program interface tkinter do show;
do pop a messagebox tkinter one of three dialog module error;
with re library (regex) to match the appropriate search URL;
with urllib library settings page HTTP requests;
with webbrowser library to jump start the browser.

1. tkinter to create a user interface renderings:

Here Insert Picture Description

def __init__(self, width=500, height=300):      #重载,定义宽/高
	self.w = width
	self.h = height

	self.title = '最牛B的视频助手'         #设置标题
	self.root = tk.Tk(className=self.title)     #软件名
	self.url = tk.StringVar()        #vip视频播放地址 字符串类型
	self.v = tk.IntVar()        #定义播放源 整形类型
	self.v.set(1)        #默认选择第一个 set 设置
	
	'''定义软件布局以及空间(Frame控件)'''
	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)     #定义一个单选按钮控件
	
	label = 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=('楷体', 12), fg='Purple', width=2, height=1, command=self.video_play)        #command绑定函数
	
	#控件布局
	frame_1.pack()
	frame_2.pack()
	
	#确定控件在软件中的位置 行:row 列:column 
	group.grid(row=0, column=0)
	tb.grid(row=0, column=1)
	label.grid(row=0, column=0)
	entry.grid(row=0, column=1)
	play.grid(row=0, column=3, ipadx=10, ipady=10)
2. Use regular expressions to parse video URL:
port = 'http://www.wmxz.wang/video.php?url='     #视频解析网站地址
if re.match(r'^https?:/{2}\w.+$', self.url.get())     #做判断,防止用户输入非法域名

Regex (regular expression) is a kind of string pattern matching (pattern)
regular expression meta-character matches the list of
Here Insert Picture Description
involved characters abbreviated match: \ w
Here Insert Picture Description
open source on GitHub recommend a regular expression tutorial: HTTPS: //github.com/ziishaned/learn-regex/blob/master/translations/README-cn.md

3. Use messagebox do link URL pop-up prompt window is wrong:
msgbox.showerror(title='错误', message='视频连接地址无效, 请重新输入!')

Renderings:
Here Insert Picture Description

4. urllib request and parse module acquires video IP
ip = self.url.get()            #拿到用户输入的视频地址
ip = parse.quote_plus(ip)            #视频播放地址编码

Send http request through the get way to get video address entered by the user
Python documentation query quote_plus () is used:
Here Insert Picture Description
urllib library: Python built-in HTTP request library contains four modules
Here Insert Picture Description

5. Use WebBrowser (a .NET control class) to open the browser automatically
webbrowser.open(port + ip)            #自动打开浏览器

Syntax: webbrowser.open (url, new = 0 , autoraise = True)
to access the system's default browser url address,
if the new = 0, url will open in the same browser window;
if new = 1, new the browser window will be opened;
new new = 2 new browser tab opens.

Additional information: there is "little friends" after Bowen released say no understanding of the principles of the program, which, in this explain.
Principle: national resolve, it means "hotlinking", that is to say in plain type gun version, in fact, the code of this program is mostly tkinter graphical user interface, much of the core code is primarily used in the Irvine site the search process.

Please pay attention to timely update micro letter public, " Barry lock and key ," No public reply back " VIP " fetch the source code and executable files packed outer attach a Member VIP viewing free online link

Guess you like

Origin blog.csdn.net/suoyue_py/article/details/100067603