使用特定主题标签时检索推特图片或视频 [英] retrieve twitter pictures or videos when using an specific hashtag
问题描述
我希望为学校活动创建一个页面,基本上我想显示所有带有特定主题标签的推文图片,如果可能,还有任何 youtube 或 vimeo 视频.
I'm looking to create a single page for a school event where basically I would like to display all the pictures of tweets with an specific hashtag, and if possible any youtube or vimeo video.
我一直在查看 twitter API,但是我找不到起点,有人知道要解决这个问题吗?
I'm been taking a look to the twitter API, however I cannot find an starting point, does anyone has any idea about to approach this?
我将不胜感激.
提前致谢.
推荐答案
您可能会发现 这篇文章有助于通过 Twitter 的 JSONP 提要抓取推文中提到的图片,用于特定搜索词或主题标签.
这是包含保存图像信息的媒体对象的单个推文的提要部分 -
This is the part of the feed for a single Tweet containing the media object that holds info about images -
"text": "#Photos on Twitter: taking flight http://t.co/qbJx26r",
"entities": {
"media": [
{
"id": 76360760611180544,
"id_str": "76360760611180544",
"media_url": "http://p.twimg.com/AQ9JtQsCEAA7dEN.jpg",
"media_url_https": "https://p.twimg.com/AQ9JtQsCEAA7dEN.jpg",
"url": "http://t.co/qbJx26r",
"display_url": "pic.twitter.com/qbJx26r",
"expanded_url": "http://twitter.com/twitter/status/76360760606986241/photo/1",
"sizes": {
"large": {
"w": 700,
"resize": "fit",
"h": 466
},
"medium": {
"w": 600,
"resize": "fit",
"h": 399
},
"small": {
"w": 340,
"resize": "fit",
"h": 226
},
"thumb": {
"w": 150,
"resize": "crop",
"h": 150
}
},
"type": "photo",
"indices": [
34,
53
]
}
],
"urls": [
],
"user_mentions": [
],
"hashtags": [
]
}
视频中没有类似的内容,但您可以查看实体"中的urls"数组,以检查对 YouTube 视频链接的引用.
There doesn't appear anything similar for videos but you can look into the "urls" array within "entities" to check for references to YouTube video links.
这篇关于使用特定主题标签时检索推特图片或视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!