import re
from urllib import request
class Spider():
def __fetch_content(self,url):
fetch = request.urlopen(url)
html = fetch.read()
html = str(html,encoding='utf-8')
return html
def __getMsg(self,html):
code = '<div class="video-info">[\s\S]*?</div>'
r = re.findall(code,html)
a = 1
def go(self,url):
a = self.__fetch_content(url)
self.__getMsg(a)
spider = Spider()
result = spider.go('https://www.panda.tv/cate/lol')
我这样写的,和你没有什么区别