def get_matches(content):
"""
Get the list of videofiles/streams.
Here you can insert some parsing code that retrieves
the list of videostreams in a given category from some site or server.
:param category: str
:return: list
"""
items = []
soup = BeautifulSoup(content, "html.parser")
for td_block in soup.find_all("div", class_=re.compile("^td_module_mx\d+")):
#print("td_block={0}".format(td_block))
if td_block.find("img") is None:
continue
item = {}
#item['thumb'] = td_block.find("img", itemprop="image")['src']
item['thumb'] = td_block.find("img")['src']
#item['name'] = td_block.find("h3", itemprop="name").text
item['name'] = td_block.find("h3").text
#item['video'] = td_block.find("a", itemprop="url")['href']
item['video'] = td_block.find("a")['href']
#item['date'] = td_block.find("time", itemprop="dateCreated").text
item['genre'] = 'Soccer'
items.append(item)
for td_block in soup.find_all("div", class_="td-block-span4"):
print("td_block={0}".format(td_block))
item = {}
#item['thumb'] = td_block.find("img", itemprop="image")['src']
item['thumb'] = td_block.find("img")['src']
#item['name'] = td_block.find("h3", itemprop="name").text
item['name'] = td_block.find("h3").text
#item['video'] = td_block.find("a", itemprop="url")['href']
item['video'] = td_block.find("a")['href']
#item['date'] = td_block.find("time", itemprop="dateCreated").text
item['genre'] = 'Soccer'
items.append(item)
return items
评论列表
文章目录