diff options
author | cedricbonhomme <devnull@localhost> | 2010-07-03 12:03:17 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2010-07-03 12:03:17 +0200 |
commit | 9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1 (patch) | |
tree | f25dd31bc148f5d972675383195fc71e7183ad6c /utils.py | |
parent | Added link and title attribute to logo image. (diff) | |
download | newspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.tar.gz newspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.tar.bz2 newspipe-9eef4f7a81f06cba4ea008ff79a2bc5b6303b1f1.zip |
Improvements, exception management.
Diffstat (limited to 'utils.py')
-rwxr-xr-x | utils.py | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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: |