mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-25 21:59:04 +01:00
[cleanup] Misc (#11716)
Authored by: bashonly, seproDev Co-authored-by: sepro <sepro@sepr0.com>
This commit is contained in:
parent
c038a7b187
commit
2b67ac300a
3 changed files with 4 additions and 9 deletions
|
@ -232,7 +232,7 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
||||||
|
|
||||||
error = self._parse_json(e.cause.response.read(), video_id)
|
error = self._parse_json(e.cause.response.read(), video_id)
|
||||||
message = error.get('message')
|
message = error.get('message')
|
||||||
if e.cause.code == 403 and error.get('code') == 'player-bad-geolocation-country':
|
if e.cause.status == 403 and error.get('code') == 'player-bad-geolocation-country':
|
||||||
self.raise_geo_restricted(msg=message)
|
self.raise_geo_restricted(msg=message)
|
||||||
raise ExtractorError(message)
|
raise ExtractorError(message)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import time
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..networking import HEADRequest
|
|
||||||
from ..utils import int_or_none
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,9 +28,6 @@ class CultureUnpluggedIE(InfoExtractor):
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
display_id = mobj.group('display_id') or video_id
|
display_id = mobj.group('display_id') or video_id
|
||||||
|
|
||||||
# request setClientTimezone.php to get PHPSESSID cookie which is need to get valid json data in the next request
|
|
||||||
self._request_webpage(HEADRequest(
|
|
||||||
'http://www.cultureunplugged.com/setClientTimezone.php?timeOffset=%d' % -(time.timezone / 3600)), display_id)
|
|
||||||
movie_data = self._download_json(
|
movie_data = self._download_json(
|
||||||
f'http://www.cultureunplugged.com/movie-data/cu-{video_id}.json', display_id)
|
f'http://www.cultureunplugged.com/movie-data/cu-{video_id}.json', display_id)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..networking.exceptions import HTTPError
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
|
@ -110,8 +111,8 @@ class PixivSketchUserIE(PixivSketchBaseIE):
|
||||||
if not traverse_obj(data, 'is_broadcasting'):
|
if not traverse_obj(data, 'is_broadcasting'):
|
||||||
try:
|
try:
|
||||||
self._call_api(user_id, 'users/current.json', url, 'Investigating reason for request failure')
|
self._call_api(user_id, 'users/current.json', url, 'Investigating reason for request failure')
|
||||||
except ExtractorError as ex:
|
except ExtractorError as e:
|
||||||
if ex.cause and ex.cause.code == 401:
|
if isinstance(e.cause, HTTPError) and e.cause.status == 401:
|
||||||
self.raise_login_required(f'Please log in, or use direct link like https://sketch.pixiv.net/@{user_id}/1234567890', method='cookies')
|
self.raise_login_required(f'Please log in, or use direct link like https://sketch.pixiv.net/@{user_id}/1234567890', method='cookies')
|
||||||
raise ExtractorError('This user is offline', expected=True)
|
raise ExtractorError('This user is offline', expected=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue