main.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:kodi-addons 作者: leonardoxiao 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号