From 6760bb2e3505240acbbf2326e47f21c5c6c6a477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 14 Jun 2020 17:03:36 -0500 Subject: tipue_search: fix description and add descriptionHtml --- plugins/tipue-search/tipue_search.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'plugins') 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

inside
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', ' ') + except: + video_desc_html = ''.join(map(str, art_desc)).replace('\n', ' ') + pass + + video_desc_text = art_desc.get_text(' ', strip=True).replace('“', '"').replace('”', '"').replace('’', "'").replace('¶', ' ').replace('^', '^') + 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, -- cgit v1.2.3