diff --git a/recipes/hackernews.recipe b/recipes/hackernews.recipe index 132876ac4e..36c8dcd287 100644 --- a/recipes/hackernews.recipe +++ b/recipes/hackernews.recipe @@ -6,7 +6,10 @@ Hacker News ''' from calibre.web.feeds.news import BasicNewsRecipe from calibre.ptempfile import PersistentTemporaryFile -from urlparse import urlparse +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse import re diff --git a/recipes/irish_times.recipe b/recipes/irish_times.recipe index 246473fc3d..519c676a85 100644 --- a/recipes/irish_times.recipe +++ b/recipes/irish_times.recipe @@ -3,14 +3,15 @@ __copyright__ = "2008, Derry FitzGerald. 2009 Modified by Ray Kinsella and David ''' irishtimes.com ''' -import urlparse, re +import re import json from uuid import uuid4 from mechanize import Request try: - from urllib.parse import urlencode + from urllib.parse import urlencode, urljoin except ImportError: from urllib import urlencode + from urlparse import urljoin from calibre.web.feeds.news import BasicNewsRecipe from calibre.ptempfile import PersistentTemporaryFile @@ -87,7 +88,7 @@ class IrishTimes(BasicNewsRecipe): pic = div.img if pic: try: - pic['src'] = urlparse.urljoin(url, pic['src']) + pic['src'] = urljoin(url, pic['src']) pic.extract() except: pic = None diff --git a/recipes/la_jornada.recipe b/recipes/la_jornada.recipe index ccdf9c347d..99147871ea 100644 --- a/recipes/la_jornada.recipe +++ b/recipes/la_jornada.recipe @@ -9,7 +9,10 @@ try: from urllib.parse import urlencode except ImportError: from urllib import urlencode -from urlparse import urlparse, urlunparse, parse_qs +try: + from urllib.parse import urlparse, urlunparse, parse_qs +except ImportError: + from urlparse import urlparse, urlunparse, parse_qs from calibre import strftime from calibre.web.feeds.news import BasicNewsRecipe diff --git a/recipes/real_clear.recipe b/recipes/real_clear.recipe index 9cc3e10cbc..750ab92073 100644 --- a/recipes/real_clear.recipe +++ b/recipes/real_clear.recipe @@ -3,9 +3,12 @@ from __future__ import print_function # .epub --test -vv --debug-pipeline debug import re import time -from urlparse import urlparse from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import NavigableString +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse class RealClear(BasicNewsRecipe): diff --git a/recipes/todays_zaman.recipe b/recipes/todays_zaman.recipe index a75c418407..87b36762b0 100644 --- a/recipes/todays_zaman.recipe +++ b/recipes/todays_zaman.recipe @@ -7,9 +7,13 @@ __copyright__ = '2014, spswerling' www.todayszaman.com ''' import re -from urlparse import urljoin from calibre.web.feeds.recipes import BasicNewsRecipe +try: + from urllib.parse import urljoin +except ImportError: + from urlparse import urljoin + class TodaysZaman(BasicNewsRecipe): diff --git a/recipes/zeitde_sub.recipe b/recipes/zeitde_sub.recipe index 03905cbbb3..072c515aa1 100644 --- a/recipes/zeitde_sub.recipe +++ b/recipes/zeitde_sub.recipe @@ -17,7 +17,10 @@ import io from calibre.web.feeds.news import BasicNewsRecipe from calibre.ptempfile import PersistentTemporaryFile from calibre import walk -from urlparse import urlparse +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse from contextlib import closing from calibre.utils.magick.draw import save_cover_data_to