Browse Source

add some comments

master
Andreas Demmelbauer 5 years ago
parent
commit
50e2052dab
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      feedcake.py

+ 4
- 0
feedcake.py View File

@@ -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]


Loading…
Cancel
Save