import re import requests import json #from urllib import parse #from lxml import etree #UA信息: headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36' } def bilibili_get_list(url): response = requests.get(url,headers=headers).text bjson = str(re.findall('__INITIAL_STATE__=(.*?);',response)) bjsonJson.loads = (bjson [2: -2 ]) Print ( " - " * 10 + " - " * 10 ) Print ( ' Title: ' + bjson [ ' h1Title ' ]) MediaInfo = bjson [ ' MediaInfo ' ] Print ( " - " * 10 + " - " * 10 ) Print ( ' Introduction: ' + MediaInfo [ ' the evaluate ' ]) #mediaInfo [ 'cover'] Cover Pub = MediaInfo [ ' Pub ' ] Print ( " - " * 10 + " - " * 10 ) Print ( ' Added Time: ' + Pub [ ' timeShow ' ]) # MediaInfo [ 'Time' ] Listed newestEp MediaInfo = [ ' newestEp ' ] Print ( " - " * 10 + " - " * 10 ) Print ( 'Status: '+newestEp['desc']) epList=bjson['epList'] for i in epList: print(i['titleFormat']+':'+i['badge']) #i['cover'] 封面 bilibili_get_list('https://www.bilibili.com/bangumi/play/ss27992/?from=search&seid=5161697106725892816')
Direct replication can be used (probably)