diff --git a/search_in_youtube_video_comments.py b/search_in_youtube_video_comments.py index 8f12253..d80ab53 100755 --- a/search_in_youtube_video_comments.py +++ b/search_in_youtube_video_comments.py @@ -14,6 +14,7 @@ def getContentFromURL(url): VIDEO_ID = input('Video id: ') API_KEY = input('YouTube Data API v3 (empty if use no-key service): ') COMMENT_REGEX = input('Comment regex: ') +OPEN_IN_FIREFOX = input('Open comment in firefox (yes or no): ') == 'yes' nextPageToken = '' commentRegexCompiled = re.compile(COMMENT_REGEX) @@ -23,8 +24,9 @@ def treatComment(comment): textOriginal = comment['snippet']['textOriginal'] if commentRegexCompiled.search(textOriginal): url = f'https://www.youtube.com/watch?v={VIDEO_ID}&lc={id}' - #os.system(f"firefox -new-tab '{url}'") print(f'{url} {textOriginal}') + if OPEN_IN_FIREFOX: + os.system(f"firefox -new-tab '{url}'") while True: data = getContentFromURL(f'commentThreads?part=snippet,replies&videoId={VIDEO_ID}&maxResults=100&pageToken={nextPageToken}')