Krittaprot
commited on
Commit
•
6bc36dc
1
Parent(s):
4ad07d8
Revised maximum default no. of comments to 50
Browse files
app.py
CHANGED
@@ -44,12 +44,12 @@ def extract_youtube_video_id(url_or_id):
|
|
44 |
# If no pattern matches, return an error or a specific message
|
45 |
return "Invalid YouTube URL or ID"
|
46 |
|
47 |
-
def comments_collector(video_link, max_comments =
|
48 |
# This function collects comments from a given YouTube video link.
|
49 |
# It uses the youtubesearchpython library to extract comments and pandas for data manipulation.
|
50 |
# Args:
|
51 |
# video_link (str): The YouTube video link from which to collect comments.
|
52 |
-
# max_comments (int, optional): The maximum number of comments to retrieve. Defaults to
|
53 |
# Returns:
|
54 |
# pandas.DataFrame: A DataFrame containing the comments, or None in case of an exception.
|
55 |
video_id = extract_youtube_video_id(video_link)
|
@@ -314,7 +314,7 @@ interface = gr.Interface(
|
|
314 |
fn=process_youtube_comments,
|
315 |
inputs=[
|
316 |
gr.Textbox(label="YouTube Video Link"),
|
317 |
-
gr.Number(label="Maximum Comments", value=
|
318 |
gr.Textbox(label="Words to exclude from cloud (comma-separated)")
|
319 |
],
|
320 |
outputs=[
|
|
|
44 |
# If no pattern matches, return an error or a specific message
|
45 |
return "Invalid YouTube URL or ID"
|
46 |
|
47 |
+
def comments_collector(video_link, max_comments = 50):
|
48 |
# This function collects comments from a given YouTube video link.
|
49 |
# It uses the youtubesearchpython library to extract comments and pandas for data manipulation.
|
50 |
# Args:
|
51 |
# video_link (str): The YouTube video link from which to collect comments.
|
52 |
+
# max_comments (int, optional): The maximum number of comments to retrieve. Defaults to 50.
|
53 |
# Returns:
|
54 |
# pandas.DataFrame: A DataFrame containing the comments, or None in case of an exception.
|
55 |
video_id = extract_youtube_video_id(video_link)
|
|
|
314 |
fn=process_youtube_comments,
|
315 |
inputs=[
|
316 |
gr.Textbox(label="YouTube Video Link"),
|
317 |
+
gr.Number(label="Maximum Comments", value=50),
|
318 |
gr.Textbox(label="Words to exclude from cloud (comma-separated)")
|
319 |
],
|
320 |
outputs=[
|