main
Bob Mottram 2020-11-22 12:32:48 +00:00
parent a41ec54370
commit 06337020f8
1 changed files with 5 additions and 1 deletions

View File

@ -329,6 +329,7 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str,
postCtr = 0 postCtr = 0
maxBytes = maxFeedItemSizeKb * 1024 maxBytes = maxFeedItemSizeKb * 1024
for rssItem in rssItems: for rssItem in rssItems:
print('YouTube feed item: ' + rssItem)
if len(rssItem) > maxBytes: if len(rssItem) > maxBytes:
print('WARN: atom feed item is too big') print('WARN: atom feed item is too big')
continue continue
@ -377,6 +378,7 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str,
break break
parsed = True parsed = True
except BaseException: except BaseException:
print('YouTube feed: failed to parse published date ' + pubDate)
pass pass
if not parsed: if not parsed:
try: try:
@ -394,7 +396,8 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str,
break break
parsed = True parsed = True
except BaseException: except BaseException:
print('WARN: unrecognized atom feed date format: ' + pubDate) print('YouTube feed: failed to parse published date ' +
pubDate)
pass pass
return result return result
@ -414,6 +417,7 @@ def xmlStrToDict(baseDir: str, domain: str, xmlStr: str,
xmlStr, moderated, mirrored, xmlStr, moderated, mirrored,
maxPostsPerSource, maxFeedItemSizeKb) maxPostsPerSource, maxFeedItemSizeKb)
elif '<yt:videoId>' in xmlStr and '<yt:channelId>' in xmlStr: elif '<yt:videoId>' in xmlStr and '<yt:channelId>' in xmlStr:
print ('YouTube feed: reading')
return atomFeedYTToDict(baseDir, domain, return atomFeedYTToDict(baseDir, domain,
xmlStr, moderated, mirrored, xmlStr, moderated, mirrored,
maxPostsPerSource, maxFeedItemSizeKb) maxPostsPerSource, maxFeedItemSizeKb)