aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-07-03 12:03:17 +0200
committercedricbonhomme <devnull@localhost>2010-07-03 12:03:17 +0200
commit9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1 (patch)
treef25dd31bc148f5d972675383195fc71e7183ad6c /utils.py
parentAdded link and title attribute to logo image. (diff)
downloadnewspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.tar.gz
newspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.tar.bz2
newspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.zip
Improvements, exception management.
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils.py b/utils.py
index e027f1dd..b3c464bb 100755
--- a/utils.py
+++ b/utils.py
@@ -212,7 +212,7 @@ def remove_feed(feed_url):
if feed_url not in line:
feeds.append(line.replace("\n", ""))
with open("./var/feed.lst", "w") as f:
- f.write("\n".join(feeds))
+ f.write("\n".join(feeds) + "\n")
# Remove articles from this feed from the SQLite base.
try:
conn = sqlite3.connect(sqlite_base, isolation_level = None)
@@ -228,8 +228,12 @@ def search_feed(url):
"""
Search a feed in a HTML page.
"""
- page = urllib2.urlopen(url)
- soup = BeautifulSoup(page)
+ soup = None
+ try:
+ page = urllib2.urlopen(url)
+ soup = BeautifulSoup(page)
+ except:
+ return None
feed_links = soup('link', type='application/atom+xml')
feed_links.extend(soup('link', type='application/rss+xml'))
for feed_link in feed_links:
bgstack15