python - Django 的 RSS 解析器

标签 python django parsing rss

来自站点的数据 http://www.case-parts.com对我来说是必要的。 为了获取这些数据,我打算使用 RSS。所有商品目录对我来说都是必需的,但是在 RSS ( http://www.case-parts.com/catalog.html ) 中,我设法只接收有关站点上最后到达的信息。如何接收所有目录?

最佳答案

Django 提供联合作为框架的一部分。您可以阅读更多相关信息 here

基本上,您创建一个类并定义提要。 (本例来自django)

class LatestEntriesFeed(Feed):
    title = "Chicagocrime.org site news"
    link = "/sitenews/"
    description = "Updates on changes and additions to chicagocrime.org."

    def items(self):
        return NewsItem.objects.order_by('-pub_date')[:5]

    def item_title(self, item):
        return item.title

    def item_description(self, item):
        return item.description

    # item_link is only needed if NewsItem has no get_absolute_url method.
    def item_link(self, item):
        return reverse('news-item', args=[item.pk])

关于python - Django 的 RSS 解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15900883/

相关文章:

python - 如何将 Scrapy Web 爬虫与 Luigi 数据管道集成?

python - super 简单并且可以使用现有 Django 身份验证系统的最佳 Django 应用程序/论坛是什么?

python - 在 Git 中,如何配置 Hook 以在接受提交后运行服务器端命令?

java - 将 jdouble* native 变量解析为 double* native 变量 (jni)

java - 在Java中将JSON的每个元素解析为数组

python - 如何在 matplotlib.pyplot.imshow 中使用 'extent'

python - Pandas :用另一个数据框替换一行

python - GAE Django cloudsql 套接字

java - 为什么 DateTimeFormatter 没有以指定格式打印日期?

python - 如何使用 pandas/python 从日期和字符串的列组合中删除时间戳?