如何创建与给定 RSS 源文章相对应的缩略图
所以我现在正在集思广益,想听听你对此的想法。
那么你知道新闻应用程序吗?
正如您所看到的,它几乎从任何新闻来源中提取缩略图。
我很好奇他们如何从各种来源收集标题和图像,因为他们的 RSS 源总是会有所不同。
我在想,对于 RSS 提要中的每篇文章,我只需迭代其内容,直到找到图像源的 preg_match
为止。
这是一般确定图像的最佳方法吗? ..标题怎么样?
:)
So I'm brainstorming right now and would like to hear your thoughts on this.
So you know the news app, pulse?
As you can see it pulls thumbnails from virtually any news source.
I'm curious as to how they gather the title and image from various sources since their RSS feeds will always vary.
I was thinking, for each article in the RSS feed, I would just iterate over its content until I find a preg_match
for an image source.
Is that the best way to generically determine the image?
..How about the title?
:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标题显然来自 RSS。查看任何 RSS 提要的标题标签。
可能唯一棘手的部分是缩略图。然而,一些 RSS 源,例如 Engadget http://www.engadget.com/rss.xml;
具有与每篇文章相关联的图像(在描述标签的 CDATA 下),可以轻松地进行正则表达式匹配。
The titles is obviously from the RSS. Look at any rss feeds for their title tags.
Probably the only tricky part is the thumbnail. However some RSS feeds like Engadget http://www.engadget.com/rss.xml;
has image associate with each article (under the CDATA of the description tag) which can be easily regex match.