fixed html tags showing up on Feeds
Added test for RSS feed with html elements
This commit is contained in:
parent
5b8f7473d0
commit
b6a64681a0
@ -5,6 +5,7 @@
|
|||||||
RSS module for InkyCal Project
|
RSS module for InkyCal Project
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
"""
|
"""
|
||||||
|
import re
|
||||||
|
|
||||||
from inkycal.modules.template import inkycal_module
|
from inkycal.modules.template import inkycal_module
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
@ -111,7 +112,9 @@ class Feeds(inkycal_module):
|
|||||||
for feeds in self.feed_urls:
|
for feeds in self.feed_urls:
|
||||||
text = feedparser.parse(feeds)
|
text = feedparser.parse(feeds)
|
||||||
for posts in text.entries:
|
for posts in text.entries:
|
||||||
parsed_feeds.append(f'•{posts.title}: {posts.summary}')
|
summary = posts.summary
|
||||||
|
parsed_feeds.append(
|
||||||
|
f"•{posts.title}: {re.sub('<[^<]+?>', '', posts.summary)}")
|
||||||
|
|
||||||
self._parsed_feeds = parsed_feeds
|
self._parsed_feeds = parsed_feeds
|
||||||
|
|
||||||
|
@ -22,6 +22,16 @@ tests = [
|
|||||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"position": 1,
|
||||||
|
"name": "Feeds",
|
||||||
|
"config": {
|
||||||
|
"size": [400,100],
|
||||||
|
"feed_urls": "https://www.anekdot.ru/rss/export_top.xml",
|
||||||
|
"shuffle_feeds": False,
|
||||||
|
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
class module_test(unittest.TestCase):
|
class module_test(unittest.TestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user