簡體   English   中英

Django的RSS解析器

[英]RSS Parser for Django

來自網站http://www.case-parts.com的數據對我來說是必要的。 為了獲得這些數據,我計划使用RSS。 所有商品目錄對我來說都是必要的,但是在RSS( http://www.case-parts.com/catalog.html )中,我設法只接收有關網站上次到達的信息。 如何收到所有目錄?

Django提供聯合作為框架的一部分。 你可以在這里閱讀更多相關信息

基本上,您創建一個類並定義提要。 (這個例子來自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])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM