aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-06-09 13:38:16 +0200
committercedricbonhomme <devnull@localhost>2010-06-09 13:38:16 +0200
commitc79327b13344e6ab150cd46062def77cf839bf86 (patch)
treef6cd6e1f26d11a84bfd4ce9cda7666630630bbd9 /pyAggr3g470r.py
parentMinor bug fix. (diff)
downloadnewspipe-c79327b13344e6ab150cd46062def77cf839bf86.tar.gz
newspipe-c79327b13344e6ab150cd46062def77cf839bf86.tar.bz2
newspipe-c79327b13344e6ab150cd46062def77cf839bf86.zip
It is now possible to add a feed just with the URL of the web page via the management page. The URL of the feed is obtained by parsing the web page with the module BeautifulSoup. There is therefore no need to edit the file feed.lst by hand.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 00987cda..4145bc99 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -182,8 +182,8 @@ class Root:
html += htmlnav
html += """<div class="left inner">\n"""
html += "<h1>Add Feeds</h1>\n"
- html += """<form method=get action="add_feed/"><input type="text" name="v" value="">\n<input
- type="submit" value="OK"></form>\n"""
+ html += """<form method=get action="/add_feed/"><input type="text" name="url" value="">\n<input
+ type="submit" value="OKi"></form>\n"""
if self.articles:
html += "<h1>Delete Feeds</h1>\n"
@@ -747,6 +747,32 @@ class Root:
list_favorites.exposed = True
+ def add_feed(self, url):
+ """
+ Add a new feed with the URL of a page.
+ """
+ html = htmlheader
+ html += htmlnav
+ html += """<div class="left inner">"""
+ # search the feed in the HTML page with BeautifulSoup
+ feed_url = utils.search_feed(url)
+ # if a feed exists
+ if feed_url is not None:
+ result = utils.add_feed(feed_url)
+ # if the feed is not already in the file feed.lst
+ if result is False:
+ html += "<p>You are already following this feed!</p>"
+ else:
+ html += """<p>Feed added. You can now <a href="/fetch/">fetch your feeds</a>.</p>"""
+ html += "<br />"
+ html += """<a href="/management/">Back to the management page.</a><br />\n"""
+ html += "<hr />\n"
+ html += htmlfooter
+ return html
+
+ add_feed.exposed = True
+
+
def export(self, export_method):
"""
Export articles stored in the SQLite database in text files.
bgstack15