Add parameter to choose whether or not to open the given comment in Firefox
This commit is contained in:
parent
5288cf9280
commit
e0e72866a2
@ -14,6 +14,7 @@ def getContentFromURL(url):
|
|||||||
VIDEO_ID = input('Video id: ')
|
VIDEO_ID = input('Video id: ')
|
||||||
API_KEY = input('YouTube Data API v3 (empty if use no-key service): ')
|
API_KEY = input('YouTube Data API v3 (empty if use no-key service): ')
|
||||||
COMMENT_REGEX = input('Comment regex: ')
|
COMMENT_REGEX = input('Comment regex: ')
|
||||||
|
OPEN_IN_FIREFOX = input('Open comment in firefox (yes or no): ') == 'yes'
|
||||||
|
|
||||||
nextPageToken = ''
|
nextPageToken = ''
|
||||||
commentRegexCompiled = re.compile(COMMENT_REGEX)
|
commentRegexCompiled = re.compile(COMMENT_REGEX)
|
||||||
@ -23,8 +24,9 @@ def treatComment(comment):
|
|||||||
textOriginal = comment['snippet']['textOriginal']
|
textOriginal = comment['snippet']['textOriginal']
|
||||||
if commentRegexCompiled.search(textOriginal):
|
if commentRegexCompiled.search(textOriginal):
|
||||||
url = f'https://www.youtube.com/watch?v={VIDEO_ID}&lc={id}'
|
url = f'https://www.youtube.com/watch?v={VIDEO_ID}&lc={id}'
|
||||||
#os.system(f"firefox -new-tab '{url}'")
|
|
||||||
print(f'{url} {textOriginal}')
|
print(f'{url} {textOriginal}')
|
||||||
|
if OPEN_IN_FIREFOX:
|
||||||
|
os.system(f"firefox -new-tab '{url}'")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
data = getContentFromURL(f'commentThreads?part=snippet,replies&videoId={VIDEO_ID}&maxResults=100&pageToken={nextPageToken}')
|
data = getContentFromURL(f'commentThreads?part=snippet,replies&videoId={VIDEO_ID}&maxResults=100&pageToken={nextPageToken}')
|
||||||
|
Reference in New Issue
Block a user