def _read_urls(self): filename = 'd:\\youtube.txt' with open(filename, 'r', encoding='utf-8') as f: urls = f.readlines() count = 0 age_limit_count = 0 for url in urls: try: count += 1 if url.find('v=') < 0: continue url = url.split("&")[0] vid = re.findall(r'v\=(.+)', url)[0] print(vid) video_webpage = self._download_webpage(url, vid) if 'age_restrictions' in video_webpage: age_limit_count += 1 elif 'Age-restricted' in video_webpage: age_limit_count += 1 except Exception as e: print(e) print(age_limit_count)
标签:count,vid,webpage,油管,age,是否是,url,limit,链接 From: https://www.cnblogs.com/onlyou13/p/17326644.html