[英]Getting photos from Twitter statuses/user_timeline
Using the Twitter API, I can get all the user's Tweets with location information.使用 Twitter API,我可以获取所有用户的带有位置信息的推文。 If they use a mobile app and attach photos, how can I get this from the API?如果他们使用移动应用程序并附上照片,我如何从 API 获取此信息?
First of all, you need to include include_entities=true
as part of the request:首先,您需要在请求中包含include_entities=true
:
ie https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter&include_entities=true
即https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter&include_entities=true
Then, look for any media_url
elements;然后,查找任何media_url
元素; those will contain the URL to any photos.这些将包含任何照片的 URL。 It may contain video links, so you'll have to filter for common image types (.png/.jpg/.gif/etc).它可能包含视频链接,因此您必须过滤常见的图像类型(.png/.jpg/.gif/等)。
See: Tweet Entities请参阅:推文实体
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.