经过一顿F12
操作,得到了以下程序
from bs4 import BeautifulSoup
import urllib,requests,re,json
print("Input webpage url:")
url=input()
print("[Info] Downloading webpage...")
res=requests.get("http://www.nicotv.me"+
BeautifulSoup(requests.get(url).content,"html.parser").select_one("#cms_player").script["src"])
print("[Info] Getting source infomation...")
cms=json.loads(re.search("\\{(.*?)\\}",res.text).group())
url=cms["jiexi"]+urllib.parse.quote(cms["url"],safe="")+"&time="+str(cms["time"])+"&auth_key="+cms["auth_key"]
print("[Info] Getting video source...")
url=BeautifulSoup(requests.get(url).text,"html.parser").select_one("#WANG")["src"]
print(re.search('video src="([^"]*?)"',requests.get(url).text)[1])