https://narito.ninja/blog/detail/56/
django2でRSS配信フィードを作成いたしました。参考にさせていただいたのは上記のサイトさまです。
https://berss.com/feed/Find.aspx
上記のRSS検出サービスで試したところ、「フィードの自動検出はできませんでした。」と出てきました。
**https://example.com/feed**というように、ページにアクセスすれば見ることはできるのです。
ただ、今回ぼくが作ったRSS取得ページはエロサイトなのでここには載せることができないです。
以前にpubDateがないことが原因と言われ、今回付けてみたのですが相変わらず取得できない状況です。
また、参考にさせていただいた**https://narito.ninja/blog/detail/56/**さまも取得サービスでは検出されていない状況でした。
なにが原因か、ご教授願いたいです。よろしくお願いします!
コードと、取得内容は以下になります。
python
1from django.contrib.syndication.views import Feed 2from django.utils.feedgenerator import Rss201rev2Feed, rfc2822_date 3from django.shortcuts import resolve_url 4from .models import Movie 5from django.urls import reverse_lazy 6 7class LatestPostFeed(Feed): 8 title = "テストサイト" 9 link = reverse_lazy('video:feed') 10 description = "テストサイトから、記事の最新情報をお届けします。" 11 12 def items(self): 13 return Movie.objects.all().order_by('-created_at') 14 15 def item_title(self, item): 16 return item.title 17 18 def item_description(self, item): 19 return item.thumb.url 20 21 def item_link(self, item): 22 return resolve_url('video:movie', pk=item.pk) 23 24 def item_categories(self, item): 25 return item.tag.split(',') 26 27 def item_pubdate(self, item): 28 return item.created_at
出力されたXML
xml
1<?xml version="1.0" encoding="utf-8"?> 2<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 3<channel> 4<title>テストサイト</title><link>http://example.com/feed/</link> 5<description>テストサイトから、記事の最新情報をお届けします。</description><atom:link href="http://example.com/feed/" rel="self"></atom:link><language>ja-JP</language><lastBuildDate>Sat, 07 Dec 2019 10:14:25 +0000</lastBuildDate> 6<item><title>Avicii - Heaven (Tribute Video)</title><link>http://example.com/movie/1</link><description>https://res.cloudinary.com/dhbyy6aei/image/upload/hqdefault_nuwtuq</description> 7<pubDate>Sat, 07 Dec 2019 10:14:25 +0000</pubDate> 8<guid>http://example.com/movie/1</guid> 9<category>a</category><category>b</category><category>c</category> 10</item> 11<item><title>Avicii2</title><link>http://example.com/movie/2</link><description>https://res.cloudinary.com/dhbyy6aei/image/upload/hqdefault_gshlmh</description> 12<pubDate>Sat, 07 Dec 2019 10:07:32 +0000</pubDate> 13<guid>http://example.com/movie/2</guid> 14<category>c</category><category>b</category><category>d</category> 15</item> 16</channel> 17</rss>
あなたの回答
tips
プレビュー