51 dom = html.fromstring(resp.text)
52 results_dom = dom.xpath(
'//li[contains(@class, "video-listing-entry")]')
57 for result_dom
in results_dom:
58 url = base_url + extract_text(result_dom.xpath(url_xpath))
59 thumbnail = extract_text(result_dom.xpath(thumbnail_xpath))
60 title = extract_text(result_dom.xpath(title_xpath))
61 p_date = extract_text(result_dom.xpath(published_date))
63 fixed_date = datetime.strptime(p_date,
'%Y-%m-%dT%H:%M:%S%z')
64 earned = extract_text(result_dom.xpath(earned_xpath))
65 views = extract_text(result_dom.xpath(views_xpath))
66 rumbles = extract_text(result_dom.xpath(rumbles_xpath))
67 author = extract_text(result_dom.xpath(author_xpath))
68 length = extract_text(result_dom.xpath(length_xpath))
70 content = f
"{views} views - {rumbles} rumbles - ${earned}"
72 content = f
"{views} views - {rumbles} rumbles"
81 'template':
'videos.html',
82 'publishedDate': fixed_date,
83 'thumbnail': thumbnail,