mirror of
https://source.netsyms.com/Mirrors/youtube-dl
synced 2026-04-24 10:36:33 +00:00
Compare commits
16 Commits
2018.06.11
...
2018.06.14
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c797db4a2f | ||
|
|
03eef0f032 | ||
|
|
aa56061627 | ||
|
|
18d66f0410 | ||
|
|
f15f7a674b | ||
|
|
9aca7fe6a3 | ||
|
|
e0671819e7 | ||
|
|
5d6c81b63f | ||
|
|
dc53c78634 | ||
|
|
7dc9c60b4b | ||
|
|
e51752754d | ||
|
|
0645be49cb | ||
|
|
a572ae6114 | ||
|
|
b2df66aeca | ||
|
|
93cffb1444 | ||
|
|
d253df2f65 |
6
.github/ISSUE_TEMPLATE.md
vendored
6
.github/ISSUE_TEMPLATE.md
vendored
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2018.06.11*. If it's not, read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
|
### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2018.06.14*. If it's not, read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
|
||||||
- [ ] I've **verified** and **I assure** that I'm running youtube-dl **2018.06.11**
|
- [ ] I've **verified** and **I assure** that I'm running youtube-dl **2018.06.14**
|
||||||
|
|
||||||
### Before submitting an *issue* make sure you have:
|
### Before submitting an *issue* make sure you have:
|
||||||
- [ ] At least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
|
- [ ] At least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
|
||||||
@@ -36,7 +36,7 @@ Add the `-v` flag to **your command line** you run youtube-dl with (`youtube-dl
|
|||||||
[debug] User config: []
|
[debug] User config: []
|
||||||
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
|
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
|
||||||
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
|
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
|
||||||
[debug] youtube-dl version 2018.06.11
|
[debug] youtube-dl version 2018.06.14
|
||||||
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
|
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
|
||||||
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
|
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
|
||||||
[debug] Proxy map: {}
|
[debug] Proxy map: {}
|
||||||
|
|||||||
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
|||||||
|
version 2018.06.14
|
||||||
|
|
||||||
|
Core
|
||||||
|
* [downloader/http] Fix retry on error when streaming to stdout (#16699)
|
||||||
|
|
||||||
|
Extractors
|
||||||
|
+ [discoverynetworks] Add support for disco-api videos (#16724)
|
||||||
|
+ [dailymotion] Add support for password protected videos (#9789)
|
||||||
|
+ [abc:iview] Add support for livestreams (#12354)
|
||||||
|
* [abc:iview] Fix extraction (#16704)
|
||||||
|
+ [crackle] Add support for sonycrackle.com (#16698)
|
||||||
|
+ [tvnet] Add support for tvnet.gov.vn (#15462)
|
||||||
|
* [nrk] Update API hosts and try all previously known ones (#16690)
|
||||||
|
* [wimp] Fix Youtube embeds extraction
|
||||||
|
|
||||||
|
|
||||||
version 2018.06.11
|
version 2018.06.11
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
|||||||
@@ -893,6 +893,7 @@
|
|||||||
- **tvigle**: Интернет-телевидение Tvigle.ru
|
- **tvigle**: Интернет-телевидение Tvigle.ru
|
||||||
- **tvland.com**
|
- **tvland.com**
|
||||||
- **TVN24**
|
- **TVN24**
|
||||||
|
- **TVNet**
|
||||||
- **TVNoe**
|
- **TVNoe**
|
||||||
- **TVNow**
|
- **TVNow**
|
||||||
- **TVNowList**
|
- **TVNowList**
|
||||||
|
|||||||
@@ -217,10 +217,11 @@ class HttpFD(FileDownloader):
|
|||||||
before = start # start measuring
|
before = start # start measuring
|
||||||
|
|
||||||
def retry(e):
|
def retry(e):
|
||||||
if ctx.tmpfilename != '-':
|
to_stdout = ctx.tmpfilename == '-'
|
||||||
|
if not to_stdout:
|
||||||
ctx.stream.close()
|
ctx.stream.close()
|
||||||
ctx.stream = None
|
ctx.stream = None
|
||||||
ctx.resume_len = os.path.getsize(encodeFilename(ctx.tmpfilename))
|
ctx.resume_len = byte_counter if to_stdout else os.path.getsize(encodeFilename(ctx.tmpfilename))
|
||||||
raise RetryDownload(e)
|
raise RetryDownload(e)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@@ -105,22 +105,22 @@ class ABCIE(InfoExtractor):
|
|||||||
|
|
||||||
class ABCIViewIE(InfoExtractor):
|
class ABCIViewIE(InfoExtractor):
|
||||||
IE_NAME = 'abc.net.au:iview'
|
IE_NAME = 'abc.net.au:iview'
|
||||||
_VALID_URL = r'https?://iview\.abc\.net\.au/programs/[^/]+/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://iview\.abc\.net\.au/(?:[^/]+/)*video/(?P<id>[^/?#]+)'
|
||||||
_GEO_COUNTRIES = ['AU']
|
_GEO_COUNTRIES = ['AU']
|
||||||
|
|
||||||
# ABC iview programs are normally available for 14 days only.
|
# ABC iview programs are normally available for 14 days only.
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://iview.abc.net.au/programs/ben-and-hollys-little-kingdom/ZY9247A021S00',
|
'url': 'https://iview.abc.net.au/show/ben-and-hollys-little-kingdom/series/0/video/ZX9371A050S00',
|
||||||
'md5': 'cde42d728b3b7c2b32b1b94b4a548afc',
|
'md5': 'cde42d728b3b7c2b32b1b94b4a548afc',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ZY9247A021S00',
|
'id': 'ZX9371A050S00',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "Gaston's Visit",
|
'title': "Gaston's Birthday",
|
||||||
'series': "Ben And Holly's Little Kingdom",
|
'series': "Ben And Holly's Little Kingdom",
|
||||||
'description': 'md5:18db170ad71cf161e006a4c688e33155',
|
'description': 'md5:f9de914d02f226968f598ac76f105bcf',
|
||||||
'upload_date': '20180318',
|
'upload_date': '20180604',
|
||||||
'uploader_id': 'abc4kids',
|
'uploader_id': 'abc4kids',
|
||||||
'timestamp': 1521400959,
|
'timestamp': 1528140219,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@@ -129,17 +129,16 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
video_params = self._download_json(
|
||||||
video_params = self._parse_json(self._search_regex(
|
'https://iview.abc.net.au/api/programs/' + video_id, video_id)
|
||||||
r'videoParams\s*=\s*({.+?});', webpage, 'video params'), video_id)
|
title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])
|
||||||
title = video_params.get('title') or video_params['seriesTitle']
|
stream = next(s for s in video_params['playlist'] if s.get('type') in ('program', 'livestream'))
|
||||||
stream = next(s for s in video_params['playlist'] if s.get('type') == 'program')
|
|
||||||
|
|
||||||
house_number = video_params.get('episodeHouseNumber')
|
house_number = video_params.get('episodeHouseNumber') or video_id
|
||||||
path = '/auth/hls/sign?ts={0}&hn={1}&d=android-mobile'.format(
|
path = '/auth/hls/sign?ts={0}&hn={1}&d=android-tablet'.format(
|
||||||
int(time.time()), house_number)
|
int(time.time()), house_number)
|
||||||
sig = hmac.new(
|
sig = hmac.new(
|
||||||
'android.content.res.Resources'.encode('utf-8'),
|
b'android.content.res.Resources',
|
||||||
path.encode('utf-8'), hashlib.sha256).hexdigest()
|
path.encode('utf-8'), hashlib.sha256).hexdigest()
|
||||||
token = self._download_webpage(
|
token = self._download_webpage(
|
||||||
'http://iview.abc.net.au{0}&sig={1}'.format(path, sig), video_id)
|
'http://iview.abc.net.au{0}&sig={1}'.format(path, sig), video_id)
|
||||||
@@ -169,18 +168,26 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
'ext': 'vtt',
|
'ext': 'vtt',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
is_live = video_params.get('livestream') == '1'
|
||||||
|
if is_live:
|
||||||
|
title = self._live_title(title)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': unescapeHTML(title),
|
'title': title,
|
||||||
'description': self._html_search_meta(['og:description', 'twitter:description'], webpage),
|
'description': video_params.get('description'),
|
||||||
'thumbnail': self._html_search_meta(['og:image', 'twitter:image:src'], webpage),
|
'thumbnail': video_params.get('thumbnail'),
|
||||||
'duration': int_or_none(video_params.get('eventDuration')),
|
'duration': int_or_none(video_params.get('eventDuration')),
|
||||||
'timestamp': parse_iso8601(video_params.get('pubDate'), ' '),
|
'timestamp': parse_iso8601(video_params.get('pubDate'), ' '),
|
||||||
'series': unescapeHTML(video_params.get('seriesTitle')),
|
'series': unescapeHTML(video_params.get('seriesTitle')),
|
||||||
'series_id': video_params.get('seriesHouseNumber') or video_id[:7],
|
'series_id': video_params.get('seriesHouseNumber') or video_id[:7],
|
||||||
'episode_number': int_or_none(self._html_search_meta('episodeNumber', webpage, default=None)),
|
'season_number': int_or_none(self._search_regex(
|
||||||
'episode': self._html_search_meta('episode_title', webpage, default=None),
|
r'\bSeries\s+(\d+)\b', title, 'season number', default=None)),
|
||||||
|
'episode_number': int_or_none(self._search_regex(
|
||||||
|
r'\bEp\s+(\d+)\b', title, 'episode number', default=None)),
|
||||||
|
'episode_id': house_number,
|
||||||
'uploader_id': video_params.get('channel'),
|
'uploader_id': video_params.get('channel'),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class CrackleIE(InfoExtractor):
|
class CrackleIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
|
_VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
# geo restricted to CA
|
# geo restricted to CA
|
||||||
'url': 'https://www.crackle.com/andromeda/2502343',
|
'url': 'https://www.crackle.com/andromeda/2502343',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -45,7 +45,10 @@ class CrackleIE(InfoExtractor):
|
|||||||
# m3u8 download
|
# m3u8 download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
'url': 'https://www.sonycrackle.com/andromeda/2502343',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import base64
|
||||||
import json
|
import hashlib
|
||||||
import itertools
|
import itertools
|
||||||
|
import json
|
||||||
|
import random
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_struct_pack
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
@@ -64,7 +68,6 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
|||||||
'uploader': 'Deadline',
|
'uploader': 'Deadline',
|
||||||
'uploader_id': 'x1xm8ri',
|
'uploader_id': 'x1xm8ri',
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
'view_count': int,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.dailymotion.com/video/x2iuewm_steam-machine-models-pricing-listed-on-steam-store-ign-news_videogames',
|
'url': 'https://www.dailymotion.com/video/x2iuewm_steam-machine-models-pricing-listed-on-steam-store-ign-news_videogames',
|
||||||
@@ -167,6 +170,17 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
|||||||
player = self._parse_json(player_v5, video_id)
|
player = self._parse_json(player_v5, video_id)
|
||||||
metadata = player['metadata']
|
metadata = player['metadata']
|
||||||
|
|
||||||
|
if metadata.get('error', {}).get('type') == 'password_protected':
|
||||||
|
password = self._downloader.params.get('videopassword')
|
||||||
|
if password:
|
||||||
|
r = int(metadata['id'][1:], 36)
|
||||||
|
us64e = lambda x: base64.urlsafe_b64encode(x).decode().strip('=')
|
||||||
|
t = ''.join(random.choice(string.ascii_letters) for i in range(10))
|
||||||
|
n = us64e(compat_struct_pack('I', r))
|
||||||
|
i = us64e(hashlib.md5(('%s%d%s' % (password, r, t)).encode()).digest())
|
||||||
|
metadata = self._download_json(
|
||||||
|
'http://www.dailymotion.com/player/metadata/video/p' + i + t + n, video_id)
|
||||||
|
|
||||||
self._check_error(metadata)
|
self._check_error(metadata)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
@@ -302,8 +316,8 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
|||||||
|
|
||||||
def _check_error(self, info):
|
def _check_error(self, info):
|
||||||
error = info.get('error')
|
error = info.get('error')
|
||||||
if info.get('error') is not None:
|
if error:
|
||||||
title = error['title']
|
title = error.get('title') or error['message']
|
||||||
# See https://developer.dailymotion.com/api#access-error
|
# See https://developer.dailymotion.com/api#access-error
|
||||||
if error.get('code') == 'DM007':
|
if error.get('code') == 'DM007':
|
||||||
self.raise_geo_restricted(msg=title)
|
self.raise_geo_restricted(msg=title)
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
|
||||||
from .brightcove import BrightcoveLegacyIE
|
from .brightcove import BrightcoveLegacyIE
|
||||||
|
from .dplay import DPlayIE
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
@@ -12,8 +12,13 @@ from ..compat import (
|
|||||||
from ..utils import smuggle_url
|
from ..utils import smuggle_url
|
||||||
|
|
||||||
|
|
||||||
class DiscoveryNetworksDeIE(InfoExtractor):
|
class DiscoveryNetworksDeIE(DPlayIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:discovery|tlc|animalplanet|dmax)\.de/(?:.*#(?P<id>\d+)|(?:[^/]+/)*videos/(?P<title>[^/?#]+))'
|
_VALID_URL = r'''(?x)https?://(?:www\.)?(?P<site>discovery|tlc|animalplanet|dmax)\.de/
|
||||||
|
(?:
|
||||||
|
.*\#(?P<id>\d+)|
|
||||||
|
(?:[^/]+/)*videos/(?P<display_id>[^/?#]+)|
|
||||||
|
programme/(?P<programme>[^/]+)/video/(?P<alternate_id>[^/]+)
|
||||||
|
)'''
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001',
|
'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001',
|
||||||
@@ -40,6 +45,14 @@ class DiscoveryNetworksDeIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
alternate_id = mobj.group('alternate_id')
|
||||||
|
if alternate_id:
|
||||||
|
self._initialize_geo_bypass({
|
||||||
|
'countries': ['DE'],
|
||||||
|
})
|
||||||
|
return self._get_disco_api_info(
|
||||||
|
url, '%s/%s' % (mobj.group('programme'), alternate_id),
|
||||||
|
'sonic-eu1-prod.disco-api.com', mobj.group('site') + 'de')
|
||||||
brightcove_id = mobj.group('id')
|
brightcove_id = mobj.group('id')
|
||||||
if not brightcove_id:
|
if not brightcove_id:
|
||||||
title = mobj.group('title')
|
title = mobj.group('title')
|
||||||
|
|||||||
@@ -97,6 +97,75 @@ class DPlayIE(InfoExtractor):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _get_disco_api_info(self, url, display_id, disco_host, realm):
|
||||||
|
disco_base = 'https://' + disco_host
|
||||||
|
token = self._download_json(
|
||||||
|
'%s/token' % disco_base, display_id, 'Downloading token',
|
||||||
|
query={
|
||||||
|
'realm': realm,
|
||||||
|
})['data']['attributes']['token']
|
||||||
|
headers = {
|
||||||
|
'Referer': url,
|
||||||
|
'Authorization': 'Bearer ' + token,
|
||||||
|
}
|
||||||
|
video = self._download_json(
|
||||||
|
'%s/content/videos/%s' % (disco_base, display_id), display_id,
|
||||||
|
headers=headers, query={
|
||||||
|
'include': 'show'
|
||||||
|
})
|
||||||
|
video_id = video['data']['id']
|
||||||
|
info = video['data']['attributes']
|
||||||
|
title = info['name']
|
||||||
|
formats = []
|
||||||
|
for format_id, format_dict in self._download_json(
|
||||||
|
'%s/playback/videoPlaybackInfo/%s' % (disco_base, video_id),
|
||||||
|
display_id, headers=headers)['data']['attributes']['streaming'].items():
|
||||||
|
if not isinstance(format_dict, dict):
|
||||||
|
continue
|
||||||
|
format_url = format_dict.get('url')
|
||||||
|
if not format_url:
|
||||||
|
continue
|
||||||
|
ext = determine_ext(format_url)
|
||||||
|
if format_id == 'dash' or ext == 'mpd':
|
||||||
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
format_url, display_id, mpd_id='dash', fatal=False))
|
||||||
|
elif format_id == 'hls' or ext == 'm3u8':
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
format_url, display_id, 'mp4',
|
||||||
|
entry_protocol='m3u8_native', m3u8_id='hls',
|
||||||
|
fatal=False))
|
||||||
|
else:
|
||||||
|
formats.append({
|
||||||
|
'url': format_url,
|
||||||
|
'format_id': format_id,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
series = None
|
||||||
|
try:
|
||||||
|
included = video.get('included')
|
||||||
|
if isinstance(included, list):
|
||||||
|
show = next(e for e in included if e.get('type') == 'show')
|
||||||
|
series = try_get(
|
||||||
|
show, lambda x: x['attributes']['name'], compat_str)
|
||||||
|
except StopIteration:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
|
'description': info.get('description'),
|
||||||
|
'duration': float_or_none(
|
||||||
|
info.get('videoDuration'), scale=1000),
|
||||||
|
'timestamp': unified_timestamp(info.get('publishStart')),
|
||||||
|
'series': series,
|
||||||
|
'season_number': int_or_none(info.get('seasonNumber')),
|
||||||
|
'episode_number': int_or_none(info.get('episodeNumber')),
|
||||||
|
'age_limit': int_or_none(info.get('minimum_age')),
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
display_id = mobj.group('id')
|
display_id = mobj.group('id')
|
||||||
@@ -113,72 +182,8 @@ class DPlayIE(InfoExtractor):
|
|||||||
|
|
||||||
if not video_id:
|
if not video_id:
|
||||||
host = mobj.group('host')
|
host = mobj.group('host')
|
||||||
disco_base = 'https://disco-api.%s' % host
|
return self._get_disco_api_info(
|
||||||
self._download_json(
|
url, display_id, 'disco-api.' + host, host.replace('.', ''))
|
||||||
'%s/token' % disco_base, display_id, 'Downloading token',
|
|
||||||
query={
|
|
||||||
'realm': host.replace('.', ''),
|
|
||||||
})
|
|
||||||
video = self._download_json(
|
|
||||||
'%s/content/videos/%s' % (disco_base, display_id), display_id,
|
|
||||||
headers={
|
|
||||||
'Referer': url,
|
|
||||||
'x-disco-client': 'WEB:UNKNOWN:dplay-client:0.0.1',
|
|
||||||
}, query={
|
|
||||||
'include': 'show'
|
|
||||||
})
|
|
||||||
video_id = video['data']['id']
|
|
||||||
info = video['data']['attributes']
|
|
||||||
title = info['name']
|
|
||||||
formats = []
|
|
||||||
for format_id, format_dict in self._download_json(
|
|
||||||
'%s/playback/videoPlaybackInfo/%s' % (disco_base, video_id),
|
|
||||||
display_id)['data']['attributes']['streaming'].items():
|
|
||||||
if not isinstance(format_dict, dict):
|
|
||||||
continue
|
|
||||||
format_url = format_dict.get('url')
|
|
||||||
if not format_url:
|
|
||||||
continue
|
|
||||||
ext = determine_ext(format_url)
|
|
||||||
if format_id == 'dash' or ext == 'mpd':
|
|
||||||
formats.extend(self._extract_mpd_formats(
|
|
||||||
format_url, display_id, mpd_id='dash', fatal=False))
|
|
||||||
elif format_id == 'hls' or ext == 'm3u8':
|
|
||||||
formats.extend(self._extract_m3u8_formats(
|
|
||||||
format_url, display_id, 'mp4',
|
|
||||||
entry_protocol='m3u8_native', m3u8_id='hls',
|
|
||||||
fatal=False))
|
|
||||||
else:
|
|
||||||
formats.append({
|
|
||||||
'url': format_url,
|
|
||||||
'format_id': format_id,
|
|
||||||
})
|
|
||||||
self._sort_formats(formats)
|
|
||||||
|
|
||||||
series = None
|
|
||||||
try:
|
|
||||||
included = video.get('included')
|
|
||||||
if isinstance(included, list):
|
|
||||||
show = next(e for e in included if e.get('type') == 'show')
|
|
||||||
series = try_get(
|
|
||||||
show, lambda x: x['attributes']['name'], compat_str)
|
|
||||||
except StopIteration:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return {
|
|
||||||
'id': video_id,
|
|
||||||
'display_id': display_id,
|
|
||||||
'title': title,
|
|
||||||
'description': info.get('description'),
|
|
||||||
'duration': float_or_none(
|
|
||||||
info.get('videoDuration'), scale=1000),
|
|
||||||
'timestamp': unified_timestamp(info.get('publishStart')),
|
|
||||||
'series': series,
|
|
||||||
'season_number': int_or_none(info.get('seasonNumber')),
|
|
||||||
'episode_number': int_or_none(info.get('episodeNumber')),
|
|
||||||
'age_limit': int_or_none(info.get('minimum_age')),
|
|
||||||
'formats': formats,
|
|
||||||
}
|
|
||||||
|
|
||||||
info = self._download_json(
|
info = self._download_json(
|
||||||
'http://%s/api/v2/ajax/videos?video_id=%s' % (domain, video_id),
|
'http://%s/api/v2/ajax/videos?video_id=%s' % (domain, video_id),
|
||||||
|
|||||||
@@ -1139,6 +1139,7 @@ from .tvc import (
|
|||||||
from .tvigle import TvigleIE
|
from .tvigle import TvigleIE
|
||||||
from .tvland import TVLandIE
|
from .tvland import TVLandIE
|
||||||
from .tvn24 import TVN24IE
|
from .tvn24 import TVN24IE
|
||||||
|
from .tvnet import TVNetIE
|
||||||
from .tvnoe import TVNoeIE
|
from .tvnoe import TVNoeIE
|
||||||
from .tvnow import (
|
from .tvnow import (
|
||||||
TVNowIE,
|
TVNowIE,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class IncIE(InfoExtractor):
|
|||||||
kaltura_id = self._search_regex(
|
kaltura_id = self._search_regex(
|
||||||
r'id=(["\'])kaltura_player_(?P<id>.+?)\1', webpage, 'kaltura id',
|
r'id=(["\'])kaltura_player_(?P<id>.+?)\1', webpage, 'kaltura id',
|
||||||
default=None, group='id') or self._parse_json(self._search_regex(
|
default=None, group='id') or self._parse_json(self._search_regex(
|
||||||
r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'),
|
r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'),
|
||||||
display_id)['vid_kaltura_id']
|
display_id)['vid_kaltura_id']
|
||||||
|
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
|
|||||||
@@ -16,12 +16,22 @@ from ..utils import (
|
|||||||
class NRKBaseIE(InfoExtractor):
|
class NRKBaseIE(InfoExtractor):
|
||||||
_GEO_COUNTRIES = ['NO']
|
_GEO_COUNTRIES = ['NO']
|
||||||
|
|
||||||
|
_api_host = None
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
data = self._download_json(
|
api_hosts = (self._api_host, ) if self._api_host else self._API_HOSTS
|
||||||
'http://%s/mediaelement/%s' % (self._API_HOST, video_id),
|
|
||||||
video_id, 'Downloading mediaelement JSON')
|
for api_host in api_hosts:
|
||||||
|
data = self._download_json(
|
||||||
|
'http://%s/mediaelement/%s' % (api_host, video_id),
|
||||||
|
video_id, 'Downloading mediaelement JSON',
|
||||||
|
fatal=api_host == api_hosts[-1])
|
||||||
|
if not data:
|
||||||
|
continue
|
||||||
|
self._api_host = api_host
|
||||||
|
break
|
||||||
|
|
||||||
title = data.get('fullTitle') or data.get('mainTitle') or data['title']
|
title = data.get('fullTitle') or data.get('mainTitle') or data['title']
|
||||||
video_id = data.get('id') or video_id
|
video_id = data.get('id') or video_id
|
||||||
@@ -191,7 +201,7 @@ class NRKIE(NRKBaseIE):
|
|||||||
)
|
)
|
||||||
(?P<id>[^?#&]+)
|
(?P<id>[^?#&]+)
|
||||||
'''
|
'''
|
||||||
_API_HOST = 'v8-psapi.nrk.no'
|
_API_HOSTS = ('psapi.nrk.no', 'v8-psapi.nrk.no')
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# video
|
# video
|
||||||
'url': 'http://www.nrk.no/video/PS*150533',
|
'url': 'http://www.nrk.no/video/PS*150533',
|
||||||
@@ -237,8 +247,7 @@ class NRKTVIE(NRKBaseIE):
|
|||||||
(?:/\d{2}-\d{2}-\d{4})?
|
(?:/\d{2}-\d{2}-\d{4})?
|
||||||
(?:\#del=(?P<part_id>\d+))?
|
(?:\#del=(?P<part_id>\d+))?
|
||||||
''' % _EPISODE_RE
|
''' % _EPISODE_RE
|
||||||
_API_HOST = 'psapi-we.nrk.no'
|
_API_HOSTS = ('psapi-ne.nrk.no', 'psapi-we.nrk.no')
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://tv.nrk.no/serie/20-spoersmaal-tv/MUHH48000314/23-05-2014',
|
'url': 'https://tv.nrk.no/serie/20-spoersmaal-tv/MUHH48000314/23-05-2014',
|
||||||
'md5': '4e9ca6629f09e588ed240fb11619922a',
|
'md5': '4e9ca6629f09e588ed240fb11619922a',
|
||||||
|
|||||||
148
youtube_dl/extractor/tvnet.py
Normal file
148
youtube_dl/extractor/tvnet.py
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
unescapeHTML,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TVNetIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:[^/]+)\.tvnet\.gov\.vn/[^/]+/(?:\d+/)?(?P<id>\d+)(?:/|$)'
|
||||||
|
_TESTS = [{
|
||||||
|
# video
|
||||||
|
'url': 'http://de.tvnet.gov.vn/video/109788/vtv1---bac-tuyet-tai-lao-cai-va-ha-giang/tin-nong-24h',
|
||||||
|
'md5': 'b4d7abe0252c9b47774760b7519c7558',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '109788',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'VTV1 - Bắc tuyết tại Lào Cai và Hà Giang',
|
||||||
|
'thumbnail': r're:(?i)https?://.*\.(?:jpg|png)',
|
||||||
|
'is_live': False,
|
||||||
|
'view_count': int,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
# audio
|
||||||
|
'url': 'http://vn.tvnet.gov.vn/radio/27017/vov1---ban-tin-chieu-10062018/doi-song-va-xa-hoi',
|
||||||
|
'md5': 'b5875ce9b0a2eecde029216d0e6db2ae',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '27017',
|
||||||
|
'ext': 'm4a',
|
||||||
|
'title': 'VOV1 - Bản tin chiều (10/06/2018)',
|
||||||
|
'thumbnail': r're:(?i)https?://.*\.(?:jpg|png)',
|
||||||
|
'is_live': False,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://us.tvnet.gov.vn/video/118023/129999/ngay-0705',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '129999',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'VTV1 - Quốc hội với cử tri (11/06/2018)',
|
||||||
|
'thumbnail': r're:(?i)https?://.*\.(?:jpg|png)',
|
||||||
|
'is_live': False,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
# live stream
|
||||||
|
'url': 'http://us.tvnet.gov.vn/kenh-truyen-hinh/1011/vtv1',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1011',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': r're:^VTV1 \| LiveTV [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
||||||
|
'thumbnail': r're:(?i)https?://.*\.(?:jpg|png)',
|
||||||
|
'is_live': True,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
# radio live stream
|
||||||
|
'url': 'http://vn.tvnet.gov.vn/kenh-truyen-hinh/1014',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1014',
|
||||||
|
'ext': 'm4a',
|
||||||
|
'title': r're:VOV1 \| LiveTV [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
||||||
|
'thumbnail': r're:(?i)https?://.*\.(?:jpg|png)',
|
||||||
|
'is_live': True,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://us.tvnet.gov.vn/phim/6136/25510/vtv3---ca-mot-doi-an-oan-tap-1-50/phim-truyen-hinh',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
title = self._og_search_title(
|
||||||
|
webpage, default=None) or self._html_search_meta(
|
||||||
|
'title', webpage, default=None) or self._search_regex(
|
||||||
|
r'<title>([^<]+)<', webpage, 'title')
|
||||||
|
title = re.sub(r'\s*-\s*TV Net\s*$', '', title)
|
||||||
|
|
||||||
|
if '/video/' in url or '/radio/' in url:
|
||||||
|
is_live = False
|
||||||
|
elif '/kenh-truyen-hinh/' in url:
|
||||||
|
is_live = True
|
||||||
|
else:
|
||||||
|
is_live = None
|
||||||
|
|
||||||
|
data_file = unescapeHTML(self._search_regex(
|
||||||
|
r'data-file=(["\'])(?P<url>(?:https?:)?//.+?)\1', webpage,
|
||||||
|
'data file', group='url'))
|
||||||
|
|
||||||
|
stream_urls = set()
|
||||||
|
formats = []
|
||||||
|
for stream in self._download_json(data_file, video_id):
|
||||||
|
if not isinstance(stream, dict):
|
||||||
|
continue
|
||||||
|
stream_url = stream.get('url')
|
||||||
|
if (stream_url in stream_urls or not stream_url or
|
||||||
|
not isinstance(stream_url, compat_str)):
|
||||||
|
continue
|
||||||
|
stream_urls.add(stream_url)
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
stream_url, video_id, 'mp4',
|
||||||
|
entry_protocol='m3u8' if is_live else 'm3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
# better support for radio streams
|
||||||
|
if title.startswith('VOV'):
|
||||||
|
for f in formats:
|
||||||
|
f.update({
|
||||||
|
'ext': 'm4a',
|
||||||
|
'vcodec': 'none',
|
||||||
|
})
|
||||||
|
|
||||||
|
thumbnail = self._og_search_thumbnail(
|
||||||
|
webpage, default=None) or unescapeHTML(
|
||||||
|
self._search_regex(
|
||||||
|
r'data-image=(["\'])(?P<url>(?:https?:)?//.+?)\1', webpage,
|
||||||
|
'thumbnail', default=None, group='url'))
|
||||||
|
|
||||||
|
if is_live:
|
||||||
|
title = self._live_title(title)
|
||||||
|
|
||||||
|
view_count = int_or_none(self._search_regex(
|
||||||
|
r'(?s)<div[^>]+\bclass=["\'].*?view-count[^>]+>.*?(\d+).*?</div>',
|
||||||
|
webpage, 'view count', default=None))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'is_live': is_live,
|
||||||
|
'view_count': view_count,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
@@ -36,7 +36,8 @@ class WimpIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
youtube_id = self._search_regex(
|
youtube_id = self._search_regex(
|
||||||
r"videoId\s*:\s*[\"']([0-9A-Za-z_-]{11})[\"']",
|
(r"videoId\s*:\s*[\"']([0-9A-Za-z_-]{11})[\"']",
|
||||||
|
r'data-id=["\']([0-9A-Za-z_-]{11})'),
|
||||||
webpage, 'video URL', default=None)
|
webpage, 'video URL', default=None)
|
||||||
if youtube_id:
|
if youtube_id:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = '2018.06.11'
|
__version__ = '2018.06.14'
|
||||||
|
|||||||
Reference in New Issue
Block a user