diff --git a/newswire.py b/newswire.py index 0bad590f7..1734a3a05 100644 --- a/newswire.py +++ b/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 '' not in xmlStr: return {} result = {} + + # is this an rss feed containing hashtag categories? if '#categories' in xmlStr: xml2StrToHashtagCategories(baseDir, xmlStr, maxCategoriesFeedItemSizeKb) return {} + rssItems = xmlStr.split('') postCtr = 0 maxBytes = maxFeedItemSizeKb * 1024 diff --git a/tests.py b/tests.py index 7126ea8a0..3af8473b3 100644 --- a/tests.py +++ b/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"