From 50e2052dab0d23c3e4e7f9f1b841444c0df101d3 Mon Sep 17 00:00:00 2001 From: Andreas Demmelbauer Date: Thu, 4 Apr 2019 09:58:10 -0700 Subject: [PATCH] add some comments --- feedcake.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/feedcake.py b/feedcake.py index 9f50931..5eadd5f 100644 --- a/feedcake.py +++ b/feedcake.py @@ -108,6 +108,8 @@ def process_feed(obj): content_soup.div.append(article_headline) article_body = online_soup.find('div', attrs={'class': 'story-content'}) content_soup.div.append(article_body) + + # Add a link to original article article_source = content_soup.new_tag('a', href=entry.link) article_source['class'] = 'source' article_source.string = 'Quelle: ' + entry.link @@ -125,6 +127,7 @@ def process_feed(obj): article_body = online_soup.find('div', attrs={'itemprop': 'articleBody'}) content_soup.div.append(article_body) + # Add a link to comments # modify original link -> mobile version and comment section link_to_comments = re.sub(r'(\/\/)', r'\1mobil.',entry.link.split('?')[0]) + '?_viewMode=forum#' article_comments_link = content_soup.new_tag('a', href=link_to_comments) @@ -134,6 +137,7 @@ def process_feed(obj): article_comments_p.append(article_comments_link) content_soup.div.append(article_comments_p) + # Add a link to original article article_source = content_soup.new_tag('a', href=entry.link.split('?')[0]) article_source['class'] = 'source' article_source.string = 'Quelle: ' + entry.link.split('?')[0]