Spaces:
Runtime error
Runtime error
Done now
Browse files
app.py
CHANGED
@@ -6,11 +6,9 @@ import re
|
|
6 |
|
7 |
pd.set_option("display.max_colwidth", -1)
|
8 |
def extract_all_comments(video_id,youtube,page_token='',comments_list =[]):
|
9 |
-
print("after 9")
|
10 |
request = youtube.commentThreads().list(part = ['id','snippet'],
|
11 |
maxResults = 100,videoId = video_id ,pageToken= page_token)
|
12 |
response = request.execute()
|
13 |
-
print("after 13")
|
14 |
for comment_details in response['items']:
|
15 |
text_dsiplay = comment_details.get('snippet').get('topLevelComment').get('snippet').get('textDisplay')
|
16 |
text_original = comment_details.get('snippet').get('topLevelComment').get('snippet').get('textOriginal')
|
@@ -37,7 +35,7 @@ def extract_comments_from_video(video_id,youtube_api_key):
|
|
37 |
try:
|
38 |
youtube = googleapiclient.discovery.build(
|
39 |
api_service_name, api_version, developerKey = youtube_api_key)
|
40 |
-
|
41 |
found_comments = extract_all_comments(video_id = video_id,youtube = youtube,page_token='')
|
42 |
print(len(found_comments))
|
43 |
comments_df = pd.DataFrame(found_comments)
|
|
|
6 |
|
7 |
pd.set_option("display.max_colwidth", -1)
|
8 |
def extract_all_comments(video_id,youtube,page_token='',comments_list =[]):
|
|
|
9 |
request = youtube.commentThreads().list(part = ['id','snippet'],
|
10 |
maxResults = 100,videoId = video_id ,pageToken= page_token)
|
11 |
response = request.execute()
|
|
|
12 |
for comment_details in response['items']:
|
13 |
text_dsiplay = comment_details.get('snippet').get('topLevelComment').get('snippet').get('textDisplay')
|
14 |
text_original = comment_details.get('snippet').get('topLevelComment').get('snippet').get('textOriginal')
|
|
|
35 |
try:
|
36 |
youtube = googleapiclient.discovery.build(
|
37 |
api_service_name, api_version, developerKey = youtube_api_key)
|
38 |
+
|
39 |
found_comments = extract_all_comments(video_id = video_id,youtube = youtube,page_token='')
|
40 |
print(len(found_comments))
|
41 |
comments_df = pd.DataFrame(found_comments)
|