diff --git a/crawler.py b/crawler.py index e57e99e..914cfe2 100644 --- a/crawler.py +++ b/crawler.py @@ -35,7 +35,10 @@ class Crawler: return articles def __download_url__(self, url): - return requests.get(url, headers=HEADERS).text + try: + return requests.get(url, headers=HEADERS).text + except requests.exceptions.ConnectionError: + print('An error has occured trying to download the HTML') def __extract_article_urls__(self, source) -> []: soup = BeautifulSoup(source, 'html.parser')