|
|
#1 |
|
Member
![]() Posts: 16
Karma: 10
Join Date: Apr 2012
Device: Bq cervantes
|
Recipe that takes feeds from newsbeuter urls file
Here it is all the information
Here the recipe: Code:
# vim:fileencoding=utf-8
rom calibre.web.feeds.news import BasicNewsRecipe
rom os.path import expanduser
mport urllib
mport re
lass NewsbeuterRecipe (BasicNewsRecipe):
__author__ = 'Marc Busqué <marc@lamarciana.com>'
__url__ = 'http://www.lamarciana.com'
__version__ = '1.0.4'
__license__ = 'GPL v3'
__copyright__ = '2014, Marc Busqué <marc@lamarciana.com>'
title = u'Newsbeuter feeds'
description = u"Dynamic recipe which is created from all feeds listed in newsbeuter url file (~/.newsbeuter/urls). Lines of that file must be in the format 'http://address_to_the_feed.com \"~Feed name\" tags'. It can filter by tags using the following from the command line: `ebook-convert newsbeuter.recipe .epub --tags=\"english,newspaper\"`. More information at: http://waiting-for-dev.github.io/blog/2014/07/20/read-your-newsbeuter-feeds-in-epub-format/"
tags = 'newsbeuter'
oldest_article = 10
max_articles_per_feed = 20
remove_empty_feeds = True
no_stylesheets = True
extra_css = urllib.urlopen('https://raw.githubusercontent.com/laMarciana/gutenweb/master/dist/gutenweb.css').read().replace('@charset "UTF-8";', '')
newsbeuter_url = expanduser('~')+'/.newsbeuter/urls'
def __init__(self, options, *args, **kwargs):
BasicNewsRecipe.__init__(self, options, *args, **kwargs)
if options.tags:
self.newsbeuter_tags = options.tags.strip().split(',')
else:
self.newsbeuter_tags = []
def get_feeds(self):
feeds = []
with open(self.newsbeuter_url) as f:
for line in f:
matches = re.compile('(.*)\s"~(.*)"\s(.*)').match(line)
url = unicode(matches.group(1))
title = unicode(matches.group(2))
matched_tags = matches.group(3).split(' ')
if self.newsbeuter_tags:
if set(self.newsbeuter_tags).issubset(set(matched_tags)):
feeds.append([title, url])
else:
feeds.append([title, url])
return feeds
|
|
|
|
![]() |
| Tags |
| newsbeuter |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| newsbeuter 2.3 - requires KTERM | twobob | Kindle Developer's Corner | 14 | 10-15-2013 06:57 PM |
| modified file: now takes ages to load | Kove | Calibre | 3 | 06-07-2013 08:07 PM |
| ESPN recipe broken due to new print urls | Odyseus | Recipes | 1 | 01-18-2012 01:23 AM |
| Techtarget feeds recipe | julio:map | Recipes | 1 | 11-09-2011 08:42 AM |
| Google Uber Recipe takes so much time | jomaweb | Calibre | 1 | 01-26-2010 04:21 AM |