mirror of https://gitlab.com/bashrc2/epicyon
Too much date checking
parent
11f218d532
commit
562e154aa9
11
newswire.py
11
newswire.py
|
@ -154,14 +154,6 @@ def parseFeedDate(pubDate: str) -> str:
|
||||||
continue
|
continue
|
||||||
if ',' not in pubDate and ',' in dateFormat:
|
if ',' not in pubDate and ',' in dateFormat:
|
||||||
continue
|
continue
|
||||||
if '-' in pubDate and '-' not in dateFormat:
|
|
||||||
continue
|
|
||||||
if '-' not in pubDate and '-' in dateFormat:
|
|
||||||
continue
|
|
||||||
if 'T' in pubDate and 'T' not in dateFormat:
|
|
||||||
continue
|
|
||||||
if 'T' not in pubDate and 'T' in dateFormat:
|
|
||||||
continue
|
|
||||||
if 'Z' in pubDate and 'Z' not in dateFormat:
|
if 'Z' in pubDate and 'Z' not in dateFormat:
|
||||||
continue
|
continue
|
||||||
if 'Z' not in pubDate and 'Z' in dateFormat:
|
if 'Z' not in pubDate and 'Z' in dateFormat:
|
||||||
|
@ -267,10 +259,13 @@ def xml2StrToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
if '<item>' not in xmlStr:
|
if '<item>' not in xmlStr:
|
||||||
return {}
|
return {}
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
|
# is this an rss feed containing hashtag categories?
|
||||||
if '<title>#categories</title>' in xmlStr:
|
if '<title>#categories</title>' in xmlStr:
|
||||||
xml2StrToHashtagCategories(baseDir, xmlStr,
|
xml2StrToHashtagCategories(baseDir, xmlStr,
|
||||||
maxCategoriesFeedItemSizeKb)
|
maxCategoriesFeedItemSizeKb)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
rssItems = xmlStr.split('<item>')
|
rssItems = xmlStr.split('<item>')
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = maxFeedItemSizeKb * 1024
|
||||||
|
|
5
tests.py
5
tests.py
|
@ -2417,6 +2417,11 @@ def testFirstParagraphFromString():
|
||||||
|
|
||||||
def testParseFeedDate():
|
def testParseFeedDate():
|
||||||
print('testParseFeedDate')
|
print('testParseFeedDate')
|
||||||
|
|
||||||
|
pubDate = "Tue, 08 Dec 2020 06:24:38 -0600"
|
||||||
|
publishedDate = parseFeedDate(pubDate)
|
||||||
|
assert publishedDate == "2020-12-08 12:24:38+00:00"
|
||||||
|
|
||||||
pubDate = "2020-08-27T16:12:34+00:00"
|
pubDate = "2020-08-27T16:12:34+00:00"
|
||||||
publishedDate = parseFeedDate(pubDate)
|
publishedDate = parseFeedDate(pubDate)
|
||||||
assert publishedDate == "2020-08-27 16:12:34+00:00"
|
assert publishedDate == "2020-08-27 16:12:34+00:00"
|
||||||
|
|
Loading…
Reference in New Issue