format cls timestamp string

This commit is contained in:
hillerliao
2022-05-15 22:47:56 +08:00
parent efd3e43d53
commit d6d7b7f3c4
6 changed files with 27 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ name = "pypi"
[packages] [packages]
bootstrap-flask = "*" bootstrap-flask = "*"
feedparser = "*" feedparser = "6.0.8"
flask-debugtoolbar = "*" flask-debugtoolbar = "*"
flask-moment = "*" flask-moment = "*"
Flask = "*" Flask = "*"
@@ -17,6 +17,7 @@ parsel = "*"
flask-script = "*" flask-script = "*"
icecream = "*" icecream = "*"
flask-analytics = "*" flask-analytics = "*"
arrow = "1.2.2"
[dev-packages] [dev-packages]
coverage = "*" coverage = "*"

18
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "244fdb2ca7e1595ca468c0f56bb8936b1fa6efce78ace99461e8ca813fe7114f" "sha256": "f26715f8bf90baafbc19577704c69a2e335d990584d26a304e4e8604004f18a4"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": {}, "requires": {},
@@ -14,6 +14,14 @@
] ]
}, },
"default": { "default": {
"arrow": {
"hashes": [
"sha256:05caf1fd3d9a11a1135b2b6f09887421153b94558e5ef4d090b567b47173ac2b",
"sha256:d622c46ca681b5b3e3574fcb60a04e5cc81b9625112d5fb2b44220c36c892177"
],
"index": "pypi",
"version": "==1.2.2"
},
"asttokens": { "asttokens": {
"hashes": [ "hashes": [
"sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c", "sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c",
@@ -209,6 +217,14 @@
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==2.12.0" "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": { "python-dotenv": {
"hashes": [ "hashes": [
"sha256:b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f", "sha256:b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f",

View File

@@ -1,3 +1,4 @@
arrow==1.2.2
asttokens==2.0.5 asttokens==2.0.5
blinker==1.4 blinker==1.4
Bootstrap-Flask==1.8.0 Bootstrap-Flask==1.8.0
@@ -7,6 +8,7 @@ click==8.0.3
colorama==0.4.4 colorama==0.4.4
cssselect==1.1.0 cssselect==1.1.0
executing==0.8.2 executing==0.8.2
feedparser==6.0.8
Flask==2.0.2 Flask==2.0.2
Flask-Analytics==0.6.0 Flask-Analytics==0.6.0
Flask-DebugToolbar==0.11.0 Flask-DebugToolbar==0.11.0

View File

@@ -1,5 +1,6 @@
import requests import requests
import json import json
import arrow
from rsshub.utils import DEFAULT_HEADERS from rsshub.utils import DEFAULT_HEADERS
@@ -10,7 +11,7 @@ def parse(post):
articleid = post['ArticleId'] articleid = post['ArticleId']
item['link'] = f'https://api3.cls.cn/share/article/{articleid}?os=android&sv=734&app=' item['link'] = f'https://api3.cls.cn/share/article/{articleid}?os=android&sv=734&app='
item['author'] = post['ArticleAuthor'] item['author'] = post['ArticleAuthor']
item['pubDate'] = post['ArticleTime'] item['pubDate'] = arrow.get(int(post['ArticleTime'])).isoformat()
return item return item

View File

@@ -1,13 +1,13 @@
import requests import requests
from rsshub.utils import DEFAULT_HEADERS from rsshub.utils import DEFAULT_HEADERS
import arrow
def parse(post): def parse(post):
item = {} item = {}
item['title'] = post['title'] if post['title'] != '' else post['content'] item['title'] = post['title'] if post['title'] != '' else post['content']
item['description'] = post['content'] item['description'] = post['content']
item['link'] = post['shareurl'] item['link'] = post['shareurl']
item['pubDate'] = post['ctime'] item['pubDate'] = arrow.get(int(post['ctime'])).isoformat()
return item return item

View File

@@ -1,14 +1,14 @@
import requests import requests
import feedparser import feedparser
import arrow
from rsshub.utils import DEFAULT_HEADERS from rsshub.utils import DEFAULT_HEADERS
from rsshub.utils import fetch
def parse(post): def parse(post):
item = {} item = {}
item['title'] = post.title item['title'] = post.title
item['description'] = post.summary 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['link'] = post.link
item['author'] = post.author if post.has_key('author') else '' item['author'] = post.author if post.has_key('author') else ''
return item return item