diff --git a/Pipfile b/Pipfile index bba1c60..c31cd01 100644 --- a/Pipfile +++ b/Pipfile @@ -5,7 +5,7 @@ name = "pypi" [packages] bootstrap-flask = "*" -feedparser = "*" +feedparser = "6.0.8" flask-debugtoolbar = "*" flask-moment = "*" Flask = "*" @@ -17,6 +17,7 @@ parsel = "*" flask-script = "*" icecream = "*" flask-analytics = "*" +arrow = "1.2.2" [dev-packages] coverage = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 9cbded3..da21d3a 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "244fdb2ca7e1595ca468c0f56bb8936b1fa6efce78ace99461e8ca813fe7114f" + "sha256": "f26715f8bf90baafbc19577704c69a2e335d990584d26a304e4e8604004f18a4" }, "pipfile-spec": 6, "requires": {}, @@ -14,6 +14,14 @@ ] }, "default": { + "arrow": { + "hashes": [ + "sha256:05caf1fd3d9a11a1135b2b6f09887421153b94558e5ef4d090b567b47173ac2b", + "sha256:d622c46ca681b5b3e3574fcb60a04e5cc81b9625112d5fb2b44220c36c892177" + ], + "index": "pypi", + "version": "==1.2.2" + }, "asttokens": { "hashes": [ "sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c", @@ -209,6 +217,14 @@ "markers": "python_version >= '3.6'", "version": "==2.12.0" }, + "python-dateutil": { + "hashes": [ + "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", + "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==2.8.2" + }, "python-dotenv": { "hashes": [ "sha256:b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f", diff --git a/requirements.txt b/requirements.txt index 9ffe42f..4d85427 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +arrow==1.2.2 asttokens==2.0.5 blinker==1.4 Bootstrap-Flask==1.8.0 @@ -7,6 +8,7 @@ click==8.0.3 colorama==0.4.4 cssselect==1.1.0 executing==0.8.2 +feedparser==6.0.8 Flask==2.0.2 Flask-Analytics==0.6.0 Flask-DebugToolbar==0.11.0 diff --git a/rsshub/spiders/cls/subject.py b/rsshub/spiders/cls/subject.py index b12b05b..14179c4 100644 --- a/rsshub/spiders/cls/subject.py +++ b/rsshub/spiders/cls/subject.py @@ -1,5 +1,6 @@ import requests import json +import arrow from rsshub.utils import DEFAULT_HEADERS @@ -10,7 +11,7 @@ def parse(post): articleid = post['ArticleId'] item['link'] = f'https://api3.cls.cn/share/article/{articleid}?os=android&sv=734&app=' item['author'] = post['ArticleAuthor'] - item['pubDate'] = post['ArticleTime'] + item['pubDate'] = arrow.get(int(post['ArticleTime'])).isoformat() return item diff --git a/rsshub/spiders/cls/telegraph.py b/rsshub/spiders/cls/telegraph.py index ae1f5a6..cecebc9 100644 --- a/rsshub/spiders/cls/telegraph.py +++ b/rsshub/spiders/cls/telegraph.py @@ -1,13 +1,13 @@ import requests from rsshub.utils import DEFAULT_HEADERS - +import arrow def parse(post): item = {} item['title'] = post['title'] if post['title'] != '' else post['content'] item['description'] = post['content'] item['link'] = post['shareurl'] - item['pubDate'] = post['ctime'] + item['pubDate'] = arrow.get(int(post['ctime'])).isoformat() return item diff --git a/rsshub/spiders/rssfilter/filter.py b/rsshub/spiders/rssfilter/filter.py index 41bdd1c..c881328 100644 --- a/rsshub/spiders/rssfilter/filter.py +++ b/rsshub/spiders/rssfilter/filter.py @@ -1,14 +1,14 @@ import requests import feedparser +import arrow from rsshub.utils import DEFAULT_HEADERS -from rsshub.utils import fetch def parse(post): item = {} item['title'] = post.title item['description'] = post.summary - item['pubDate'] = post.published if post.has_key('published') else '' + item['pubDate'] = post.published if post.has_key('published') else arrow.now().isoformat() item['link'] = post.link item['author'] = post.author if post.has_key('author') else '' return item