aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/tipue-search/tipue_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/tipue-search/tipue_search.py')
-rw-r--r--plugins/tipue-search/tipue_search.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/tipue-search/tipue_search.py b/plugins/tipue-search/tipue_search.py
index 5928576..788a8b9 100644
--- a/plugins/tipue-search/tipue_search.py
+++ b/plugins/tipue-search/tipue_search.py
@@ -62,9 +62,21 @@ class Tipue_Search_JSON_Generator(object):
soup_title = BeautifulSoup(article.title.replace(' ', ' '), 'html.parser')
video_title = soup_title.get_text(' ', strip=True).replace('“', '"').replace('”', '"').replace('’', "'").replace('^', '^')
- soup_text = BeautifulSoup(article.content, 'html.parser')
- video_text = soup_text.get_text(' ', strip=True).replace('“', '"').replace('”', '"').replace('’', "'").replace('¶', ' ').replace('^', '^')
- video_text = ' '.join(video_text.split())
+ # description
+ art_desc = BeautifulSoup(article.content, 'html.parser')
+
+ # fix ignore <h1> inside <figure> description
+ try:
+ art_desc = art_desc.find('figure').find_all_next('p')
+ art_desc_html = ''.join(map(str, art_desc))
+ art_desc = BeautifulSoup(art_desc_html, 'html.parser')
+ video_desc_html = art_desc_html.replace('\n', '&#32;')
+ except:
+ video_desc_html = ''.join(map(str, art_desc)).replace('\n', '&#32;')
+ pass
+
+ video_desc_text = art_desc.get_text(' ', strip=True).replace('“', '"').replace('”', '"').replace('’', "'").replace('¶', ' ').replace('^', '&#94;')
+ video_desc_text = ' '.join(video_desc_text.split())
# base url
if self.relative_urls:
@@ -118,7 +130,8 @@ class Tipue_Search_JSON_Generator(object):
video_tags = dict((num, tag) for num, tag in enumerate(data_tags))
node = {'title': video_title,
- 'description': video_text,
+ 'description': video_desc_text,
+ 'descriptionHtml': video_desc_html,
'videoThumbnail': url_image,
'formatStreams': {
'url': video_src,