srt_captions = caption.generate_srt_captions().split("\n\n")
except Exception as exception:
cp.print_error("failed to retrieve srt for video - ", url)
cp.print_error(exception)
continue
translator = str.maketrans("", "", string.punctuation) // to remove punctuation
srt_tag_re = re.compile(r"<.*?>|\(.*?\)|\[.*?\]")
keyword_exist = False
for captions in srt_captions:
if keyword in captions or plural.plural(keyword) in captions:
keyword_exist = True
break
if not keyword_exist:
cp.print_warning("keywords never appear in the video - ", url)
continue
try:
crawler = YoutubeCrawler(url)
audio_data = crawler.get_audio()
except Exception as exception:
cp.print_error("failed to download audio file for video ", url)
cp.print_warning(exception)
continue
collected_data = []