backend newsfeed version is 0.3 (conforming to weboob version)
This commit is contained in:
parent
1be1af5a5d
commit
fe39601810
3 changed files with 15 additions and 19 deletions
|
|
@ -27,7 +27,7 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
|
|||
NAME = 'newsfeed'
|
||||
MAINTAINER = u"Clément Schreiner"
|
||||
EMAIL = "clemux@clemux.info"
|
||||
VERSION = "0.1"
|
||||
VERSION = "0.3"
|
||||
DESCRIPTION = "Loads RSS and Atom feeds from any websites"
|
||||
LICENSE = "GPLv3"
|
||||
CONFIG = {'url': BaseBackend.ConfigField(description="Atom/RSS feed's url"),}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import datetime
|
|||
import feedparser
|
||||
|
||||
|
||||
__all__ = ['Entry', 'Newsfeed']
|
||||
|
||||
|
||||
class Entry:
|
||||
def __init__(self, entry, url2id=None):
|
||||
if url2id:
|
||||
|
|
@ -60,17 +63,11 @@ class Entry:
|
|||
else:
|
||||
self.content = None
|
||||
|
||||
|
||||
|
||||
|
||||
class Newsfeed:
|
||||
def __init__(self, url, url2id=None):
|
||||
self.feed = feedparser.parse(url)
|
||||
self.url2id = url2id
|
||||
|
||||
|
||||
|
||||
|
||||
def iter_entries(self):
|
||||
for entry in self.feed['entries']:
|
||||
yield Entry(entry, self.url2id)
|
||||
|
|
@ -79,4 +76,3 @@ class Newsfeed:
|
|||
for entry in self.feed['entries']:
|
||||
if entry.id == id:
|
||||
return Entry(entry, self.url2id)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue