英文:
Youtube Data API - How to get video comments from multiple video id
问题
I can help you with the translation. Here's the translated text:
有没有办法使用YouTube API从多个视频ID获取YouTube评论列表?
这是我的视频ID
video_ids = [
'QSWYyoF79oE',
'Wh66ThpxvI4',
'weG-sqHHCB8',
'8dgEh5crj0I',
'SydRcrZ166A',
'Svz5F8J1Ap0',
'Lj_zPn3GsjE',
'g89VhNDBrsY',
]
我尝试了这样使用
request = youtube.commentThreads().list(part='snippet,replies', videoId= ','.join(video_ids), maxResults=50)
response = request.execute()
这是响应,仍然出现错误。是否有解决方案或其他方法?
返回错误信息:"通过<code><a href="/youtube/v3/docs/commentThreads/list#videoId">videoId</a></code>参数标识的视频无法找到。详细信息:"[{‘message’: ‘通过<code><a href="/youtube/v3/docs/commentThreads/list#videoId">videoId</a></code>参数标识的视频无法找到。’, ‘domain’: ‘youtube.commentThread’, ‘reason’: ‘videoNotFound’, ‘location’: ‘videoId’, ‘locationType’: ‘parameter’}]"
Is there anything else you would like to translate?
英文:
is there a way to get list of Youtube Comment using Youtube API from multiple video id?
This is my video id
video_ids = [
'QSWYyoF79oE',
'Wh66ThpxvI4',
'weG-sqHHCB8',
'8dgEh5crj0I',
'SydRcrZ166A',
'Svz5F8J1Ap0',
'Lj_zPn3GsjE',
'g89VhNDBrsY',
]
I tried using like this
request = youtube.commentThreads().list(part='snippet, replies', videoId= ','.join(video_ids), maxResults = 50)
response = request.execute()
And this is the response, still error. Is there solution or other way?
returned "The video identified by the <code><a href="/youtube/v3/docs/commentThreads/list#videoId">videoId</a></code> parameter could not be found.". Details: "[{'message': 'The video identified by the <code><a href="/youtube/v3/docs/commentThreads/list#videoId">videoId</a></code> parameter could not be found.', 'domain': 'youtube.commentThread', 'reason': 'videoNotFound', 'location': 'videoId', 'locationType': 'parameter'}]">```
</details>
# 答案1
**得分**: 1
你需要在HTTP请求之外进行迭代:
```python
for video_id in video_ids:
request = youtube.commentThreads().list(part='snippet, replies', videoId=video_id, maxResults=50)
response = request.execute()
英文:
You need to iterate outside the http request:
for video_id in video_ids:
request = youtube.commentThreads().list(part='snippet, replies', videoId=video_id, maxResults = 50)
response = request.execute()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论