Skip to content

Commit

Permalink
Remove no longer needed compat_str around geturl
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Feb 29, 2020
1 parent fca6dba commit 7947a1f
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion youtube_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ def _extract_ism_formats(self, ism_url, video_id, ism_id=None, note=None, errnot
return []
ism_doc, urlh = res

return self._parse_ism_formats(ism_doc, compat_str(urlh.geturl()), ism_id)
return self._parse_ism_formats(ism_doc, urlh.geturl(), ism_id)

def _parse_ism_formats(self, ism_doc, ism_url, ism_id=None):
"""
Expand Down
3 changes: 1 addition & 2 deletions youtube_dl/extractor/eporner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re

from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
encode_base_n,
ExtractorError,
Expand Down Expand Up @@ -55,7 +54,7 @@ def _real_extract(self, url):

webpage, urlh = self._download_webpage_handle(url, display_id)

video_id = self._match_id(compat_str(urlh.geturl()))
video_id = self._match_id(urlh.geturl())

hash = self._search_regex(
r'hash\s*:\s*["\']([\da-f]{32})', webpage, 'hash')
Expand Down
6 changes: 3 additions & 3 deletions youtube_dl/extractor/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,7 @@ def _real_extract(self, url):

if head_response is not False:
# Check for redirect
new_url = compat_str(head_response.geturl())
new_url = head_response.geturl()
if url != new_url:
self.report_following_redirect(new_url)
if force_videoid:
Expand Down Expand Up @@ -2387,12 +2387,12 @@ def _real_extract(self, url):
return self.playlist_result(
self._parse_xspf(
doc, video_id, xspf_url=url,
xspf_base_url=compat_str(full_response.geturl())),
xspf_base_url=full_response.geturl()),
video_id)
elif re.match(r'(?i)^(?:{[^}]+})?MPD$', doc.tag):
info_dict['formats'] = self._parse_mpd_formats(
doc,
mpd_base_url=compat_str(full_response.geturl()).rpartition('/')[0],
mpd_base_url=full_response.geturl().rpartition('/')[0],
mpd_url=url)
self._sort_formats(info_dict['formats'])
return info_dict
Expand Down
3 changes: 1 addition & 2 deletions youtube_dl/extractor/lecturio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re

from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
clean_html,
determine_ext,
Expand Down Expand Up @@ -36,7 +35,7 @@ def _login(self):
self._LOGIN_URL, None, 'Downloading login popup')

def is_logged(url_handle):
return self._LOGIN_URL not in compat_str(url_handle.geturl())
return self._LOGIN_URL not in url_handle.geturl()

# Already logged in
if is_logged(urlh):
Expand Down
5 changes: 2 additions & 3 deletions youtube_dl/extractor/linuxacademy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ..compat import (
compat_b64decode,
compat_HTTPError,
compat_str,
)
from ..utils import (
ExtractorError,
Expand Down Expand Up @@ -99,7 +98,7 @@ def random_string():
'sso': 'true',
})

login_state_url = compat_str(urlh.geturl())
login_state_url = urlh.geturl()

try:
login_page = self._download_webpage(
Expand Down Expand Up @@ -129,7 +128,7 @@ def random_string():
})

access_token = self._search_regex(
r'access_token=([^=&]+)', compat_str(urlh.geturl()),
r'access_token=([^=&]+)', urlh.geturl(),
'access token')

self._download_webpage(
Expand Down
3 changes: 1 addition & 2 deletions youtube_dl/extractor/mediaset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .theplatform import ThePlatformBaseIE
from ..compat import (
compat_parse_qs,
compat_str,
compat_urllib_parse_urlparse,
)
from ..utils import (
Expand Down Expand Up @@ -114,7 +113,7 @@ def _program_guid(qs):
continue
urlh = ie._request_webpage(
embed_url, video_id, note='Following embed URL redirect')
embed_url = compat_str(urlh.geturl())
embed_url = urlh.geturl()
program_guid = _program_guid(_qs(embed_url))
if program_guid:
entries.append(embed_url)
Expand Down
2 changes: 1 addition & 1 deletion youtube_dl/extractor/mediasite.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _real_extract(self, url):
query = mobj.group('query')

webpage, urlh = self._download_webpage_handle(url, resource_id) # XXX: add UrlReferrer?
redirect_url = compat_str(urlh.geturl())
redirect_url = urlh.geturl()

# XXX: might have also extracted UrlReferrer and QueryString from the html
service_path = compat_urlparse.urljoin(redirect_url, self._html_search_regex(
Expand Down
2 changes: 1 addition & 1 deletion youtube_dl/extractor/platzi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _login(self):
headers={'Referer': self._LOGIN_URL})

# login succeeded
if 'platzi.com/login' not in compat_str(urlh.geturl()):
if 'platzi.com/login' not in urlh.geturl():
return

login_error = self._webpage_read_content(
Expand Down
5 changes: 2 additions & 3 deletions youtube_dl/extractor/safari.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from ..compat import (
compat_parse_qs,
compat_str,
compat_urlparse,
)
from ..utils import (
Expand Down Expand Up @@ -39,13 +38,13 @@ def _login(self):
'Downloading login page')

def is_logged(urlh):
return 'learning.oreilly.com/home/' in compat_str(urlh.geturl())
return 'learning.oreilly.com/home/' in urlh.geturl()

if is_logged(urlh):
self.LOGGED_IN = True
return

redirect_url = compat_str(urlh.geturl())
redirect_url = urlh.geturl()
parsed_url = compat_urlparse.urlparse(redirect_url)
qs = compat_parse_qs(parsed_url.query)
next_uri = compat_urlparse.urljoin(
Expand Down
3 changes: 1 addition & 2 deletions youtube_dl/extractor/teachable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from .common import InfoExtractor
from .wistia import WistiaIE
from ..compat import compat_str
from ..utils import (
clean_html,
ExtractorError,
Expand Down Expand Up @@ -58,7 +57,7 @@ def is_logged(webpage):
self._logged_in = True
return

login_url = compat_str(urlh.geturl())
login_url = urlh.geturl()

login_form = self._hidden_inputs(login_page)

Expand Down
3 changes: 1 addition & 2 deletions youtube_dl/extractor/tumblr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re

from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
Expand Down Expand Up @@ -151,7 +150,7 @@ def _real_extract(self, url):
url = 'http://%s.tumblr.com/post/%s/' % (blog, video_id)
webpage, urlh = self._download_webpage_handle(url, video_id)

redirect_url = compat_str(urlh.geturl())
redirect_url = urlh.geturl()
if 'tumblr.com/safe-mode' in redirect_url or redirect_url.startswith('/safe-mode'):
raise ExtractorError(
'This Tumblr may contain sensitive media. '
Expand Down
2 changes: 1 addition & 1 deletion youtube_dl/extractor/vimeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def _real_extract(self, url):
# Retrieve video webpage to extract further information
webpage, urlh = self._download_webpage_handle(
url, video_id, headers=headers)
redirect_url = compat_str(urlh.geturl())
redirect_url = urlh.geturl()
except ExtractorError as ee:
if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
errmsg = ee.cause.read()
Expand Down

0 comments on commit 7947a1f

Please sign in to comment.