Browse Source

add timeout to title fetching

Nick Sweeting 7 years ago
parent
commit
db0461ec4e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      archivebox/util.py

+ 1 - 1
archivebox/util.py

@@ -234,7 +234,7 @@ def fetch_page_title(url, default=True):
         default = url
 
     try:
-        html_content = urllib.request.urlopen(url).read().decode('utf-8')
+        html_content = urllib.request.urlopen(url, timeout=10).read().decode('utf-8')
 
         match = re.search('<title>(.*?)</title>', html_content)
         return match.group(1) if match else default or None