Commit ea4d4360 authored by Kiste's avatar Kiste
Browse files

Catch error

parent c47a8c8a
......@@ -7,6 +7,7 @@ published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
"""
import json
import urllib.error
import urllib.parse
import urllib.request
......@@ -89,7 +90,11 @@ def do_feed(url, rules_path, verbose):
url = "{0.scheme}://{0.netloc}/".format(urllib.parse.urlsplit(link))
if verbose:
print('>Rule match!')
soup = BeautifulSoup(urllib.request.urlopen(link), 'lxml')
try:
soup = BeautifulSoup(urllib.request.urlopen(link), 'lxml')
except urllib.error.HTTPError:
fe.content('Error fetching content!')
continue
comments = None
if 'comments' in url_rules:
comments = soup.select(url_rules['comments'])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment