我正在使用以下URL来获取用户的推文。
以下是我在“包含”中获取的响应,其中包含媒体列表。
https://api.twitter.com/2/users/{user_twitter_id}/tweets
以下是我的请求参数
query_params = {
'max_results': max_results,
'expansions': 'attachments.media_keys',
'tweet.fields': 'id,created_at,text,author_id,in_reply_to_user_id,referenced_tweets,attachments,withheld,geo,entities,public_metrics,possibly_sensitive,source,lang,context_annotations,conversation_id,reply_settings',
'media.fields': 'media_key,duration_ms,height,preview_image_url,type,url,width,public_metrics,non_public_metrics,organic_metrics,promoted_metrics,alt_text'
}
以下是我在“包含”中获取的响应,其中包含媒体列表。
"includes": {
"media": [
{
"height": 750,
"media_key": "3_1489397927281840131",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKtnhhDWUAMtyBi.jpg",
"width": 1125
},
{
"height": 750,
"media_key": "3_1489397930452783110",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKtnhs3XEAYeMkP.jpg",
"width": 1125
},
{
"height": 750,
"media_key": "3_1489397944214302727",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKtnigIXMAcTO6t.jpg",
"width": 1125
},
{
"duration_ms": 242784,
"height": 1080,
"media_key": "13_1489018359819771906",
"preview_image_url": "https://pbs.twimg.com/media/FKoOePDWYAA1ZZB.jpg",
"public_metrics": {
"view_count": 275300
},
"type": "video",
"width": 1920
},
{
"height": 2400,
"media_key": "3_1488933061307809794",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKnAuwWWQAIZZ8J.jpg",
"width": 3000
},
{
"height": 2000,
"media_key": "3_1488640905187938304",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKi3BB_X0AA47_h.jpg",
"width": 3000
},
{
"duration_ms": 41374,
"height": 1080,
"media_key": "13_1488623384250527746",
"preview_image_url": "https://pbs.twimg.com/amplify_video_thumb/1488623384250527746/img/K2fiO7GwjmxL0H89.jpg",
"public_metrics": {
"view_count": 239341
},
"type": "video",
"width": 1080
},
{
"height": 2000,
"media_key": "3_1488548514921603078",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKhi_NbWYAYqP04.jpg",
"width": 3000
},
{
"height": 750,
"media_key": "3_1488336416732028931",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKeiFeGXIAMgHQx.jpg",
"width": 1125
},
{
"duration_ms": 53136,
"height": 1080,
"media_key": "13_1488316251667582978",
"preview_image_url": "https://pbs.twimg.com/amplify_video_thumb/1488316251667582978/img/DE2q07gtwoARK76r.jpg",
"public_metrics": {
"view_count": 214984
},
"type": "video",
"width": 1080
},
{
"duration_ms": 40248,
"height": 1080,
"media_key": "13_1488154727544152064",
"preview_image_url": "https://pbs.twimg.com/media/FKb85iAXoAou4ED.jpg",
"public_metrics": {
"view_count": 242329
},
"type": "video",
"width": 1080
},
{
"height": 913,
"media_key": "3_1487927712761229314",
"type": "photo",
"url": "https://pbs.twimg.com/media/FKYuXxKXsAIbXd2.jpg",
"width": 1200
},
{
"duration_ms": 35785,
"height": 1080,
"media_key": "13_1487538546948939777",
"preview_image_url": "https://pbs.twimg.com/amplify_video_thumb/1487538546948939777/img/qzUmEZKmD6ii_0dM.jpg",
"public_metrics": {
"view_count": 290603
},
"type": "video",
"width": 1080
}
]
}
正如您在媒体的响应中所看到的,我们有视频类型和媒体密钥,但是没有实际的视频网址,我们能看到的只是视频缩略图。请告诉我如何获取视频网址以及预览图像网址。