mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-21 18:24:47 +00:00
Compare commits
No commits in common. "a183837ec8bb5e28fe6eb3a9d77ea2d0d7a106bd" and "8597a4331e8535a246d777bb8397bdcab251766c" have entirely different histories.
a183837ec8
...
8597a4331e
@ -12,7 +12,6 @@ import datetime as dt
|
|||||||
import io
|
import io
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
import ntpath
|
|
||||||
import pickle
|
import pickle
|
||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
@ -254,6 +253,12 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(sanitize_path('abc.../def...'), 'abc..#\\def..#')
|
self.assertEqual(sanitize_path('abc.../def...'), 'abc..#\\def..#')
|
||||||
self.assertEqual(sanitize_path('C:\\abc:%(title)s.%(ext)s'), 'C:\\abc#%(title)s.%(ext)s')
|
self.assertEqual(sanitize_path('C:\\abc:%(title)s.%(ext)s'), 'C:\\abc#%(title)s.%(ext)s')
|
||||||
|
|
||||||
|
# Check with nt._path_normpath if available
|
||||||
|
try:
|
||||||
|
from nt import _path_normpath as nt_path_normpath
|
||||||
|
except ImportError:
|
||||||
|
nt_path_normpath = None
|
||||||
|
|
||||||
for test, expected in [
|
for test, expected in [
|
||||||
('C:\\', 'C:\\'),
|
('C:\\', 'C:\\'),
|
||||||
('../abc', '..\\abc'),
|
('../abc', '..\\abc'),
|
||||||
@ -271,7 +276,8 @@ class TestUtil(unittest.TestCase):
|
|||||||
result = sanitize_path(test)
|
result = sanitize_path(test)
|
||||||
assert result == expected, f'{test} was incorrectly resolved'
|
assert result == expected, f'{test} was incorrectly resolved'
|
||||||
assert result == sanitize_path(result), f'{test} changed after sanitizing again'
|
assert result == sanitize_path(result), f'{test} changed after sanitizing again'
|
||||||
assert result == ntpath.normpath(test), f'{test} does not match ntpath.normpath'
|
if nt_path_normpath:
|
||||||
|
assert result == nt_path_normpath(test), f'{test} does not match nt._path_normpath'
|
||||||
|
|
||||||
def test_sanitize_url(self):
|
def test_sanitize_url(self):
|
||||||
self.assertEqual(sanitize_url('//foo.bar'), 'http://foo.bar')
|
self.assertEqual(sanitize_url('//foo.bar'), 'http://foo.bar')
|
||||||
|
|||||||
@ -2,14 +2,7 @@ import itertools
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..networking import HEADRequest
|
from ..networking import HEADRequest
|
||||||
from ..utils import (
|
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
|
||||||
ExtractorError,
|
|
||||||
int_or_none,
|
|
||||||
update_url_query,
|
|
||||||
url_or_none,
|
|
||||||
urljoin,
|
|
||||||
)
|
|
||||||
from ..utils.traversal import traverse_obj
|
|
||||||
|
|
||||||
|
|
||||||
class TenPlayIE(InfoExtractor):
|
class TenPlayIE(InfoExtractor):
|
||||||
@ -109,19 +102,14 @@ class TenPlayIE(InfoExtractor):
|
|||||||
video_data = self._download_json(
|
video_data = self._download_json(
|
||||||
f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}',
|
f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}',
|
||||||
content_id, 'Downloading video JSON')
|
content_id, 'Downloading video JSON')
|
||||||
# Dash URL 403s, changing the m3u8 format works
|
|
||||||
m3u8_url = self._request_webpage(
|
m3u8_url = self._request_webpage(
|
||||||
HEADRequest(update_url_query(video_data['items'][0]['dashManifestUrl'], {
|
HEADRequest(video_data['items'][0]['HLSURL']),
|
||||||
'manifest': 'm3u',
|
|
||||||
})),
|
|
||||||
content_id, 'Checking stream URL').url
|
content_id, 'Checking stream URL').url
|
||||||
if '10play-not-in-oz' in m3u8_url:
|
if '10play-not-in-oz' in m3u8_url:
|
||||||
self.raise_geo_restricted(countries=['AU'])
|
self.raise_geo_restricted(countries=['AU'])
|
||||||
if '10play_unsupported' in m3u8_url:
|
|
||||||
raise ExtractorError('Unable to extract stream')
|
|
||||||
# Attempt to get a higher quality stream
|
# Attempt to get a higher quality stream
|
||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
m3u8_url.replace(',150,75,55,0000', ',500,300,150,75,55,0000'),
|
m3u8_url.replace(',150,75,55,0000', ',300,150,75,55,0000'),
|
||||||
content_id, 'mp4', fatal=False)
|
content_id, 'mp4', fatal=False)
|
||||||
if not formats:
|
if not formats:
|
||||||
formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4')
|
formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user