def __get_menu_items(self, url, soupstrainer_parser_selector, routing_action, video_dictionary_action=None):
response = requests.get(url)
tiles = SoupStrainer('a', soupstrainer_parser_selector)
soup = BeautifulSoup(response.content, "html.parser", parse_only=tiles)
listing = []
for tile in soup.find_all(class_="tile"):
link_to_video = tile["href"]
thumbnail, title = self.__get_thumbnail_and_title(tile)
video_dictionary = None
if video_dictionary_action is not None:
video_dictionary = video_dictionary_action(tile)
item = helperobjects.TitleItem(title, {'action': routing_action, 'video': link_to_video},
False, thumbnail, video_dictionary)
listing.append(item)
return listing
评论列表
文章目录