feedy icon indicating copy to clipboard operation
feedy copied to clipboard

Caching body

Open c-bata opened this issue 9 years ago • 0 comments

from feedy import Feedy
from feedy_plugins import social_share_plugin
from bs4 import BeautifulSoup

feedy = Feedy('feedy.dat')


@feedy.add('http://rss.cnn.com/rss/edition.rss')
def cnn(info, body):
    soup = BeautifulSoup(body, "html.parser")
    for x in soup.find_all('img'):
        print(x['src'])


@feedy.add('http://rss.cnn.com/rss/edition.rss')
@social_share_plugin
def cnn_shared(info, body, social_count):
    article = {
        'url': info['article_url'],
        'title': info['article_title'],
        'pocket': social_count['pocket_count'],
        'facebook': social_count['facebook_count'],
    }
    print(article)

It is fetched two times.

c-bata avatar May 27 '16 23:05 c-bata