def run(url): print('\n*** RUN %s *****************************\n' % url) _source = source.build_source_from_url(url) for _video in video.get_videos_from_source(_source): store.save_video(_video) print(_video.title) print('\n** END %s ******************************\n' % url)
def get_video_from_play_list_items(bs, url): items = bs.find_all('td', {'class': 'pl-video-title'}) for item in items: ref = get_video_ref_from_url(item.find('a')['href']) video = VideoSource(title=item.find('a').get_text().strip(), url=get_domain_name(url) + item.find('a')['href'], ref=ref) if video.is_valid(): owner_dom = item.find('div', {'class': 'pl-video-owner'}) if owner_dom: source_dom = owner_dom.find('a') split_source_url = source.validate_url(get_domain_name(url) + source_dom['href']) _source = store.find_source_by_slug(split_source_url['slug']) if not _source: _source = source.build_source_from_url(get_domain_name(url) + source_dom['href']) video.source = _source.__dict__ yield video