mirror of https://gitlab.com/bashrc2/epicyon
More debug
parent
5a695d689d
commit
6cb9d7e399
15
newswire.py
15
newswire.py
|
@ -215,6 +215,8 @@ def xml2StrToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = maxFeedItemSizeKb * 1024
|
||||||
for rssItem in rssItems:
|
for rssItem in rssItems:
|
||||||
|
if not rssItem:
|
||||||
|
continue
|
||||||
if len(rssItem) > maxBytes:
|
if len(rssItem) > maxBytes:
|
||||||
print('WARN: rss feed item is too big')
|
print('WARN: rss feed item is too big')
|
||||||
continue
|
continue
|
||||||
|
@ -266,6 +268,8 @@ def xml2StrToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr += 1
|
postCtr += 1
|
||||||
if postCtr >= maxPostsPerSource:
|
if postCtr >= maxPostsPerSource:
|
||||||
break
|
break
|
||||||
|
if postCtr > 0:
|
||||||
|
print('Added ' + str(postCtr) + ' rss feed items to newswire')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,6 +286,8 @@ def atomFeedToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = maxFeedItemSizeKb * 1024
|
||||||
for atomItem in atomItems:
|
for atomItem in atomItems:
|
||||||
|
if not atomItem:
|
||||||
|
continue
|
||||||
if len(atomItem) > maxBytes:
|
if len(atomItem) > maxBytes:
|
||||||
print('WARN: atom feed item is too big')
|
print('WARN: atom feed item is too big')
|
||||||
continue
|
continue
|
||||||
|
@ -333,6 +339,8 @@ def atomFeedToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr += 1
|
postCtr += 1
|
||||||
if postCtr >= maxPostsPerSource:
|
if postCtr >= maxPostsPerSource:
|
||||||
break
|
break
|
||||||
|
if postCtr > 0:
|
||||||
|
print('Added ' + str(postCtr) + ' atom feed items to newswire')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,7 +359,10 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = maxFeedItemSizeKb * 1024
|
||||||
for atomItem in atomItems:
|
for atomItem in atomItems:
|
||||||
print('YouTube feed item: ' + atomItem)
|
if not atomItem:
|
||||||
|
continue
|
||||||
|
if not atomItem.strip():
|
||||||
|
continue
|
||||||
if len(atomItem) > maxBytes:
|
if len(atomItem) > maxBytes:
|
||||||
print('WARN: atom feed item is too big')
|
print('WARN: atom feed item is too big')
|
||||||
continue
|
continue
|
||||||
|
@ -397,6 +408,8 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str,
|
||||||
postCtr += 1
|
postCtr += 1
|
||||||
if postCtr >= maxPostsPerSource:
|
if postCtr >= maxPostsPerSource:
|
||||||
break
|
break
|
||||||
|
if postCtr > 0:
|
||||||
|
print('Added ' + str(postCtr) + ' YouTube feed items to newswire')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue