forked from indymedia/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
|
||||
if ',' not in pubDate and ',' in dateFormat:
|
||||
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:
|
||||
continue
|
||||
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:
|
||||
return {}
|
||||
result = {}
|
||||
|
||||
# is this an rss feed containing hashtag categories?
|
||||
if '<title>#categories</title>' in xmlStr:
|
||||
xml2StrToHashtagCategories(baseDir, xmlStr,
|
||||
maxCategoriesFeedItemSizeKb)
|
||||
return {}
|
||||
|
||||
rssItems = xmlStr.split('<item>')
|
||||
postCtr = 0
|
||||
maxBytes = maxFeedItemSizeKb * 1024
|
||||
|
|
5
tests.py
5
tests.py
|
@ -2417,6 +2417,11 @@ def testFirstParagraphFromString():
|
|||
|
||||
def 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"
|
||||
publishedDate = parseFeedDate(pubDate)
|
||||
assert publishedDate == "2020-08-27 16:12:34+00:00"
|
||||
|
|
Loading…
Reference in New Issue