mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-07 18:26:20 +01:00
py3: Port use of urlparse in recipes
This commit is contained in:
parent
40491089f1
commit
c32b7daafa
6 changed files with 25 additions and 8 deletions
|
|
@ -6,7 +6,10 @@
|
||||||
'''
|
'''
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from urlparse import urlparse
|
try:
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urlparse
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,15 @@
|
||||||
'''
|
'''
|
||||||
irishtimes.com
|
irishtimes.com
|
||||||
'''
|
'''
|
||||||
import urlparse, re
|
import re
|
||||||
import json
|
import json
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from mechanize import Request
|
from mechanize import Request
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode, urljoin
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
from urlparse import urljoin
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
|
|
@ -87,7 +88,7 @@ def get_obfuscated_article(self, url):
|
||||||
pic = div.img
|
pic = div.img
|
||||||
if pic:
|
if pic:
|
||||||
try:
|
try:
|
||||||
pic['src'] = urlparse.urljoin(url, pic['src'])
|
pic['src'] = urljoin(url, pic['src'])
|
||||||
pic.extract()
|
pic.extract()
|
||||||
except:
|
except:
|
||||||
pic = None
|
pic = None
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib import urlencode
|
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 import strftime
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,12 @@
|
||||||
# .epub --test -vv --debug-pipeline debug
|
# .epub --test -vv --debug-pipeline debug
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from urlparse import urlparse
|
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import NavigableString
|
from calibre.ebooks.BeautifulSoup import NavigableString
|
||||||
|
try:
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
|
||||||
class RealClear(BasicNewsRecipe):
|
class RealClear(BasicNewsRecipe):
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,13 @@
|
||||||
www.todayszaman.com
|
www.todayszaman.com
|
||||||
'''
|
'''
|
||||||
import re
|
import re
|
||||||
from urlparse import urljoin
|
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urljoin
|
||||||
|
|
||||||
|
|
||||||
class TodaysZaman(BasicNewsRecipe):
|
class TodaysZaman(BasicNewsRecipe):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from calibre import walk
|
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 contextlib import closing
|
||||||
from calibre.utils.magick.draw import save_cover_data_to
|
from calibre.utils.magick.draw import save_cover_data_to
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue