mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-27 19:04:32 +01:00
commit
9a6d52db94
6
.github/ISSUE_TEMPLATE/1_broken_site.md
vendored
6
.github/ISSUE_TEMPLATE/1_broken_site.md
vendored
@ -18,7 +18,7 @@ title: ''
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
||||||
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.07.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.08.02. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
||||||
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
||||||
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
|
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
|
||||||
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
||||||
@ -26,7 +26,7 @@ Carefully read and work through this check list in order to prevent the most com
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I'm reporting a broken site support
|
- [ ] I'm reporting a broken site support
|
||||||
- [ ] I've verified that I'm running youtube-dl version **2019.07.30**
|
- [ ] I've verified that I'm running youtube-dl version **2019.08.02**
|
||||||
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
||||||
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
|
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
|
||||||
- [ ] I've searched the bugtracker for similar issues including closed ones
|
- [ ] I've searched the bugtracker for similar issues including closed ones
|
||||||
@ -41,7 +41,7 @@ Add the `-v` flag to your command line you run youtube-dl with (`youtube-dl -v <
|
|||||||
[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 2019.07.30
|
[debug] youtube-dl version 2019.08.02
|
||||||
[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: {}
|
||||||
|
@ -19,7 +19,7 @@ labels: 'site-support-request'
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
||||||
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.07.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.08.02. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
||||||
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
||||||
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://yt-dl.org/copyright-infringement. youtube-dl does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
|
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://yt-dl.org/copyright-infringement. youtube-dl does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
|
||||||
- Search the bugtracker for similar site support requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
- Search the bugtracker for similar site support requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
||||||
@ -27,7 +27,7 @@ Carefully read and work through this check list in order to prevent the most com
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I'm reporting a new site support request
|
- [ ] I'm reporting a new site support request
|
||||||
- [ ] I've verified that I'm running youtube-dl version **2019.07.30**
|
- [ ] I've verified that I'm running youtube-dl version **2019.08.02**
|
||||||
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
||||||
- [ ] I've checked that none of provided URLs violate any copyrights
|
- [ ] I've checked that none of provided URLs violate any copyrights
|
||||||
- [ ] I've searched the bugtracker for similar site support requests including closed ones
|
- [ ] I've searched the bugtracker for similar site support requests including closed ones
|
||||||
|
@ -18,13 +18,13 @@ title: ''
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
||||||
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.07.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.08.02. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
||||||
- Search the bugtracker for similar site feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
- Search the bugtracker for similar site feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
||||||
- Finally, put x into all relevant boxes (like this [x])
|
- Finally, put x into all relevant boxes (like this [x])
|
||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I'm reporting a site feature request
|
- [ ] I'm reporting a site feature request
|
||||||
- [ ] I've verified that I'm running youtube-dl version **2019.07.30**
|
- [ ] I've verified that I'm running youtube-dl version **2019.08.02**
|
||||||
- [ ] I've searched the bugtracker for similar site feature requests including closed ones
|
- [ ] I've searched the bugtracker for similar site feature requests including closed ones
|
||||||
|
|
||||||
|
|
||||||
|
6
.github/ISSUE_TEMPLATE/4_bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/4_bug_report.md
vendored
@ -18,7 +18,7 @@ title: ''
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
||||||
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.07.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.08.02. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
||||||
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
|
||||||
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
|
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
|
||||||
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
||||||
@ -27,7 +27,7 @@ Carefully read and work through this check list in order to prevent the most com
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I'm reporting a broken site support issue
|
- [ ] I'm reporting a broken site support issue
|
||||||
- [ ] I've verified that I'm running youtube-dl version **2019.07.30**
|
- [ ] I've verified that I'm running youtube-dl version **2019.08.02**
|
||||||
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
- [ ] I've checked that all provided URLs are alive and playable in a browser
|
||||||
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
|
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
|
||||||
- [ ] I've searched the bugtracker for similar bug reports including closed ones
|
- [ ] I've searched the bugtracker for similar bug reports including closed ones
|
||||||
@ -43,7 +43,7 @@ Add the `-v` flag to your command line you run youtube-dl with (`youtube-dl -v <
|
|||||||
[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 2019.07.30
|
[debug] youtube-dl version 2019.08.02
|
||||||
[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: {}
|
||||||
|
4
.github/ISSUE_TEMPLATE/5_feature_request.md
vendored
4
.github/ISSUE_TEMPLATE/5_feature_request.md
vendored
@ -19,13 +19,13 @@ labels: 'request'
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
|
||||||
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.07.30. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.08.02. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
|
||||||
- Search the bugtracker for similar feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
- Search the bugtracker for similar feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
|
||||||
- Finally, put x into all relevant boxes (like this [x])
|
- Finally, put x into all relevant boxes (like this [x])
|
||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I'm reporting a feature request
|
- [ ] I'm reporting a feature request
|
||||||
- [ ] I've verified that I'm running youtube-dl version **2019.07.30**
|
- [ ] I've verified that I'm running youtube-dl version **2019.08.02**
|
||||||
- [ ] I've searched the bugtracker for similar feature requests including closed ones
|
- [ ] I've searched the bugtracker for similar feature requests including closed ones
|
||||||
|
|
||||||
|
|
||||||
|
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
version 2019.08.02
|
||||||
|
|
||||||
|
Extractors
|
||||||
|
+ [tvigle] Add support for HLS and DASH formats (#21967)
|
||||||
|
* [tvigle] Fix extraction (#21967)
|
||||||
|
+ [yandexvideo] Add support for DASH formats (#21971)
|
||||||
|
* [discovery] Use API call for video data extraction (#21808)
|
||||||
|
+ [mgtv] Extract format_note (#21881)
|
||||||
|
* [tvn24] Fix metadata extraction (#21833, #21834)
|
||||||
|
* [dlive] Relax URL regular expression (#21909)
|
||||||
|
+ [openload] Add support for oload.best (#21913)
|
||||||
|
* [youtube] Improve metadata extraction for age gate content (#21943)
|
||||||
|
|
||||||
|
|
||||||
version 2019.07.30
|
version 2019.07.30
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
66
README.md
66
README.md
@ -1216,6 +1216,72 @@ Incorrect:
|
|||||||
'PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
|
'PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Inline values
|
||||||
|
|
||||||
|
Extracting variables is acceptable for reducing code duplication and improving readability of complex expressions. However, you should avoid extracting variables used only once and moving them to opposite parts of the extractor file, which makes reading the linear flow difficult.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
|
||||||
|
```
|
||||||
|
|
||||||
|
Incorrect:
|
||||||
|
|
||||||
|
```python
|
||||||
|
TITLE_RE = r'<title>([^<]+)</title>'
|
||||||
|
# ...some lines of code...
|
||||||
|
title = self._html_search_regex(TITLE_RE, webpage, 'title')
|
||||||
|
```
|
||||||
|
|
||||||
|
### Collapse fallbacks
|
||||||
|
|
||||||
|
Multiple fallback values can quickly become unwieldy. Collapse multiple fallback values into a single expression via a list of patterns.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
Good:
|
||||||
|
|
||||||
|
```python
|
||||||
|
description = self._html_search_meta(
|
||||||
|
['og:description', 'description', 'twitter:description'],
|
||||||
|
webpage, 'description', default=None)
|
||||||
|
```
|
||||||
|
|
||||||
|
Unwieldy:
|
||||||
|
|
||||||
|
```python
|
||||||
|
description = (
|
||||||
|
self._og_search_description(webpage, default=None)
|
||||||
|
or self._html_search_meta('description', webpage, default=None)
|
||||||
|
or self._html_search_meta('twitter:description', webpage, default=None))
|
||||||
|
```
|
||||||
|
|
||||||
|
Methods supporting list of patterns are: `_search_regex`, `_html_search_regex`, `_og_search_property`, `_html_search_meta`.
|
||||||
|
|
||||||
|
### Trailing parentheses
|
||||||
|
|
||||||
|
Always move trailing parentheses after the last argument.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
||||||
|
list)
|
||||||
|
```
|
||||||
|
|
||||||
|
Incorrect:
|
||||||
|
|
||||||
|
```python
|
||||||
|
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
||||||
|
list,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
### Use convenience conversion and parsing functions
|
### Use convenience conversion and parsing functions
|
||||||
|
|
||||||
Wrap all extracted numeric data into safe functions from [`youtube_dl/utils.py`](https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/utils.py): `int_or_none`, `float_or_none`. Use them for string to number conversions as well.
|
Wrap all extracted numeric data into safe functions from [`youtube_dl/utils.py`](https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/utils.py): `int_or_none`, `float_or_none`. Use them for string to number conversions as well.
|
||||||
|
@ -5,14 +5,8 @@ import re
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
from .discoverygo import DiscoveryGoBaseIE
|
from .discoverygo import DiscoveryGoBaseIE
|
||||||
from ..compat import (
|
from ..compat import compat_urllib_parse_unquote
|
||||||
compat_str,
|
from ..utils import ExtractorError
|
||||||
compat_urllib_parse_unquote,
|
|
||||||
)
|
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
try_get,
|
|
||||||
)
|
|
||||||
from ..compat import compat_HTTPError
|
from ..compat import compat_HTTPError
|
||||||
|
|
||||||
|
|
||||||
@ -40,15 +34,15 @@ class DiscoveryIE(DiscoveryGoBaseIE):
|
|||||||
cookingchanneltv|
|
cookingchanneltv|
|
||||||
motortrend
|
motortrend
|
||||||
)
|
)
|
||||||
)\.com(?P<path>/tv-shows/[^/]+/(?:video|full-episode)s/(?P<id>[^./?#]+))'''
|
)\.com/tv-shows/(?P<show_slug>[^/]+)/(?:video|full-episode)s/(?P<id>[^./?#]+)'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.discovery.com/tv-shows/cash-cab/videos/dave-foley',
|
'url': 'https://go.discovery.com/tv-shows/cash-cab/videos/riding-with-matthew-perry',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5a2d9b4d6b66d17a5026e1fd',
|
'id': '5a2f35ce6b66d17a5026e29e',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Dave Foley',
|
'title': 'Riding with Matthew Perry',
|
||||||
'description': 'md5:4b39bcafccf9167ca42810eb5f28b01f',
|
'description': 'md5:a34333153e79bc4526019a5129e7f878',
|
||||||
'duration': 608,
|
'duration': 84,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True, # requires ffmpeg
|
'skip_download': True, # requires ffmpeg
|
||||||
@ -59,20 +53,17 @@ class DiscoveryIE(DiscoveryGoBaseIE):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'https://go.discovery.com/tv-shows/alaskan-bush-people/videos/follow-your-own-road',
|
'url': 'https://go.discovery.com/tv-shows/alaskan-bush-people/videos/follow-your-own-road',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
# using `show_slug` is important to get the correct video data
|
||||||
|
'url': 'https://www.sciencechannel.com/tv-shows/mythbusters-on-science/full-episodes/christmas-special',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
_GEO_COUNTRIES = ['US']
|
_GEO_COUNTRIES = ['US']
|
||||||
_GEO_BYPASS = False
|
_GEO_BYPASS = False
|
||||||
|
_API_BASE_URL = 'https://api.discovery.com/v1/'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
site, path, display_id = re.match(self._VALID_URL, url).groups()
|
site, show_slug, display_id = re.match(self._VALID_URL, url).groups()
|
||||||
webpage = self._download_webpage(url, display_id)
|
|
||||||
|
|
||||||
react_data = self._parse_json(self._search_regex(
|
|
||||||
r'window\.__reactTransmitPacket\s*=\s*({.+?});',
|
|
||||||
webpage, 'react data'), display_id)
|
|
||||||
content_blocks = react_data['layout'][path]['contentBlocks']
|
|
||||||
video = next(cb for cb in content_blocks if cb.get('type') == 'video')['content']['items'][0]
|
|
||||||
video_id = video['id']
|
|
||||||
|
|
||||||
access_token = None
|
access_token = None
|
||||||
cookies = self._get_cookies(url)
|
cookies = self._get_cookies(url)
|
||||||
@ -82,27 +73,34 @@ class DiscoveryIE(DiscoveryGoBaseIE):
|
|||||||
if auth_storage_cookie and auth_storage_cookie.value:
|
if auth_storage_cookie and auth_storage_cookie.value:
|
||||||
auth_storage = self._parse_json(compat_urllib_parse_unquote(
|
auth_storage = self._parse_json(compat_urllib_parse_unquote(
|
||||||
compat_urllib_parse_unquote(auth_storage_cookie.value)),
|
compat_urllib_parse_unquote(auth_storage_cookie.value)),
|
||||||
video_id, fatal=False) or {}
|
display_id, fatal=False) or {}
|
||||||
access_token = auth_storage.get('a') or auth_storage.get('access_token')
|
access_token = auth_storage.get('a') or auth_storage.get('access_token')
|
||||||
|
|
||||||
if not access_token:
|
if not access_token:
|
||||||
access_token = self._download_json(
|
access_token = self._download_json(
|
||||||
'https://%s.com/anonymous' % site, display_id, query={
|
'https://%s.com/anonymous' % site, display_id,
|
||||||
|
'Downloading token JSON metadata', query={
|
||||||
'authRel': 'authorization',
|
'authRel': 'authorization',
|
||||||
'client_id': try_get(
|
'client_id': '3020a40c2356a645b4b4',
|
||||||
react_data, lambda x: x['application']['apiClientId'],
|
|
||||||
compat_str) or '3020a40c2356a645b4b4',
|
|
||||||
'nonce': ''.join([random.choice(string.ascii_letters) for _ in range(32)]),
|
'nonce': ''.join([random.choice(string.ascii_letters) for _ in range(32)]),
|
||||||
'redirectUri': 'https://fusion.ddmcdn.com/app/mercury-sdk/180/redirectHandler.html?https://www.%s.com' % site,
|
'redirectUri': 'https://fusion.ddmcdn.com/app/mercury-sdk/180/redirectHandler.html?https://www.%s.com' % site,
|
||||||
})['access_token']
|
})['access_token']
|
||||||
|
|
||||||
try:
|
headers = self.geo_verification_headers()
|
||||||
headers = self.geo_verification_headers()
|
headers['Authorization'] = 'Bearer ' + access_token
|
||||||
headers['Authorization'] = 'Bearer ' + access_token
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
video = self._download_json(
|
||||||
|
self._API_BASE_URL + 'content/videos',
|
||||||
|
display_id, 'Downloading content JSON metadata',
|
||||||
|
headers=headers, query={
|
||||||
|
'slug': display_id,
|
||||||
|
'show_slug': show_slug,
|
||||||
|
})[0]
|
||||||
|
video_id = video['id']
|
||||||
stream = self._download_json(
|
stream = self._download_json(
|
||||||
'https://api.discovery.com/v1/streaming/video/' + video_id,
|
self._API_BASE_URL + 'streaming/video/' + video_id,
|
||||||
display_id, headers=headers)
|
display_id, 'Downloading streaming JSON metadata', headers=headers)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (401, 403):
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (401, 403):
|
||||||
e_description = self._parse_json(
|
e_description = self._parse_json(
|
||||||
|
@ -17,7 +17,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class RoosterTeethIE(InfoExtractor):
|
class RoosterTeethIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:.+?\.)?roosterteeth\.com/episode/(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:.+?\.)?roosterteeth\.com/(?:episode|watch)/(?P<id>[^/?#&]+)'
|
||||||
_LOGIN_URL = 'https://roosterteeth.com/login'
|
_LOGIN_URL = 'https://roosterteeth.com/login'
|
||||||
_NETRC_MACHINE = 'roosterteeth'
|
_NETRC_MACHINE = 'roosterteeth'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@ -49,6 +49,9 @@ class RoosterTeethIE(InfoExtractor):
|
|||||||
# only available for FIRST members
|
# only available for FIRST members
|
||||||
'url': 'http://roosterteeth.com/episode/rt-docs-the-world-s-greatest-head-massage-the-world-s-greatest-head-massage-an-asmr-journey-part-one',
|
'url': 'http://roosterteeth.com/episode/rt-docs-the-world-s-greatest-head-massage-the-world-s-greatest-head-massage-an-asmr-journey-part-one',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://roosterteeth.com/watch/million-dollars-but-season-2-million-dollars-but-the-game-announcement',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
|
@ -9,6 +9,8 @@ from ..utils import (
|
|||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_age_limit,
|
parse_age_limit,
|
||||||
|
try_get,
|
||||||
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -23,11 +25,10 @@ class TvigleIE(InfoExtractor):
|
|||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'http://www.tvigle.ru/video/sokrat/',
|
'url': 'http://www.tvigle.ru/video/sokrat/',
|
||||||
'md5': '36514aed3657d4f70b4b2cef8eb520cd',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1848932',
|
'id': '1848932',
|
||||||
'display_id': 'sokrat',
|
'display_id': 'sokrat',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'Сократ',
|
'title': 'Сократ',
|
||||||
'description': 'md5:d6b92ffb7217b4b8ebad2e7665253c17',
|
'description': 'md5:d6b92ffb7217b4b8ebad2e7665253c17',
|
||||||
'duration': 6586,
|
'duration': 6586,
|
||||||
@ -37,7 +38,6 @@ class TvigleIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://www.tvigle.ru/video/vladimir-vysotskii/vedushchii-teleprogrammy-60-minut-ssha-o-vladimire-vysotskom/',
|
'url': 'http://www.tvigle.ru/video/vladimir-vysotskii/vedushchii-teleprogrammy-60-minut-ssha-o-vladimire-vysotskom/',
|
||||||
'md5': 'e7efe5350dd5011d0de6550b53c3ba7b',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5142516',
|
'id': '5142516',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
@ -62,7 +62,7 @@ class TvigleIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
video_id = self._html_search_regex(
|
video_id = self._html_search_regex(
|
||||||
(r'<div[^>]+class=["\']player["\'][^>]+id=["\'](\d+)',
|
(r'<div[^>]+class=["\']player["\'][^>]+id=["\'](\d+)',
|
||||||
r'var\s+cloudId\s*=\s*["\'](\d+)',
|
r'cloudId\s*=\s*["\'](\d+)',
|
||||||
r'class="video-preview current_playing" id="(\d+)"'),
|
r'class="video-preview current_playing" id="(\d+)"'),
|
||||||
webpage, 'video id')
|
webpage, 'video id')
|
||||||
|
|
||||||
@ -90,21 +90,40 @@ class TvigleIE(InfoExtractor):
|
|||||||
age_limit = parse_age_limit(item.get('ageRestrictions'))
|
age_limit = parse_age_limit(item.get('ageRestrictions'))
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for vcodec, fmts in item['videos'].items():
|
for vcodec, url_or_fmts in item['videos'].items():
|
||||||
if vcodec == 'hls':
|
if vcodec == 'hls':
|
||||||
continue
|
m3u8_url = url_or_none(url_or_fmts)
|
||||||
for format_id, video_url in fmts.items():
|
if not m3u8_url:
|
||||||
if format_id == 'm3u8':
|
|
||||||
continue
|
continue
|
||||||
height = self._search_regex(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
r'^(\d+)[pP]$', format_id, 'height', default=None)
|
m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native',
|
||||||
formats.append({
|
m3u8_id='hls', fatal=False))
|
||||||
'url': video_url,
|
elif vcodec == 'dash':
|
||||||
'format_id': '%s-%s' % (vcodec, format_id),
|
mpd_url = url_or_none(url_or_fmts)
|
||||||
'vcodec': vcodec,
|
if not mpd_url:
|
||||||
'height': int_or_none(height),
|
continue
|
||||||
'filesize': int_or_none(item.get('video_files_size', {}).get(vcodec, {}).get(format_id)),
|
formats.extend(self._extract_mpd_formats(
|
||||||
})
|
mpd_url, video_id, mpd_id='dash', fatal=False))
|
||||||
|
else:
|
||||||
|
if not isinstance(url_or_fmts, dict):
|
||||||
|
continue
|
||||||
|
for format_id, video_url in url_or_fmts.items():
|
||||||
|
if format_id == 'm3u8':
|
||||||
|
continue
|
||||||
|
video_url = url_or_none(video_url)
|
||||||
|
if not video_url:
|
||||||
|
continue
|
||||||
|
height = self._search_regex(
|
||||||
|
r'^(\d+)[pP]$', format_id, 'height', default=None)
|
||||||
|
filesize = int_or_none(try_get(
|
||||||
|
item, lambda x: x['video_files_size'][vcodec][format_id]))
|
||||||
|
formats.append({
|
||||||
|
'url': video_url,
|
||||||
|
'format_id': '%s-%s' % (vcodec, format_id),
|
||||||
|
'vcodec': vcodec,
|
||||||
|
'height': int_or_none(height),
|
||||||
|
'filesize': filesize,
|
||||||
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import functools
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
|
compat_kwargs,
|
||||||
compat_HTTPError,
|
compat_HTTPError,
|
||||||
compat_str,
|
compat_str,
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
@ -19,6 +21,7 @@ from ..utils import (
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
NO_DEFAULT,
|
NO_DEFAULT,
|
||||||
|
OnDemandPagedList,
|
||||||
parse_filesize,
|
parse_filesize,
|
||||||
qualities,
|
qualities,
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
@ -98,6 +101,13 @@ class VimeoBaseInfoExtractor(InfoExtractor):
|
|||||||
webpage, 'vuid', group='vuid')
|
webpage, 'vuid', group='vuid')
|
||||||
return xsrft, vuid
|
return xsrft, vuid
|
||||||
|
|
||||||
|
def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
|
||||||
|
vimeo_config = self._search_regex(
|
||||||
|
r'vimeo\.config\s*=\s*(?:({.+?})|_extend\([^,]+,\s+({.+?})\));',
|
||||||
|
webpage, 'vimeo config', *args, **compat_kwargs(kwargs))
|
||||||
|
if vimeo_config:
|
||||||
|
return self._parse_json(vimeo_config, video_id)
|
||||||
|
|
||||||
def _set_vimeo_cookie(self, name, value):
|
def _set_vimeo_cookie(self, name, value):
|
||||||
self._set_cookie('vimeo.com', name, value)
|
self._set_cookie('vimeo.com', name, value)
|
||||||
|
|
||||||
@ -253,7 +263,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
\.
|
\.
|
||||||
)?
|
)?
|
||||||
vimeo(?P<pro>pro)?\.com/
|
vimeo(?P<pro>pro)?\.com/
|
||||||
(?!(?:channels|album)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
|
(?!(?:channels|album|showcase)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
|
||||||
(?:.*?/)?
|
(?:.*?/)?
|
||||||
(?:
|
(?:
|
||||||
(?:
|
(?:
|
||||||
@ -580,11 +590,9 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
# and latter we extract those that are Vimeo specific.
|
# and latter we extract those that are Vimeo specific.
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
vimeo_config = self._search_regex(
|
vimeo_config = self._extract_vimeo_config(webpage, video_id, default=None)
|
||||||
r'vimeo\.config\s*=\s*(?:({.+?})|_extend\([^,]+,\s+({.+?})\));', webpage,
|
|
||||||
'vimeo config', default=None)
|
|
||||||
if vimeo_config:
|
if vimeo_config:
|
||||||
seed_status = self._parse_json(vimeo_config, video_id).get('seed_status', {})
|
seed_status = vimeo_config.get('seed_status', {})
|
||||||
if seed_status.get('state') == 'failed':
|
if seed_status.get('state') == 'failed':
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'%s said: %s' % (self.IE_NAME, seed_status['title']),
|
'%s said: %s' % (self.IE_NAME, seed_status['title']),
|
||||||
@ -905,7 +913,7 @@ class VimeoUserIE(VimeoChannelIE):
|
|||||||
|
|
||||||
class VimeoAlbumIE(VimeoChannelIE):
|
class VimeoAlbumIE(VimeoChannelIE):
|
||||||
IE_NAME = 'vimeo:album'
|
IE_NAME = 'vimeo:album'
|
||||||
_VALID_URL = r'https://vimeo\.com/album/(?P<id>\d+)(?:$|[?#]|/(?!video))'
|
_VALID_URL = r'https://vimeo\.com/(?:album|showcase)/(?P<id>\d+)(?:$|[?#]|/(?!video))'
|
||||||
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://vimeo.com/album/2632481',
|
'url': 'https://vimeo.com/album/2632481',
|
||||||
@ -925,21 +933,39 @@ class VimeoAlbumIE(VimeoChannelIE):
|
|||||||
'params': {
|
'params': {
|
||||||
'videopassword': 'youtube-dl',
|
'videopassword': 'youtube-dl',
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
'url': 'https://vimeo.com/album/2632481/sort:plays/format:thumbnail',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
# TODO: respect page number
|
|
||||||
'url': 'https://vimeo.com/album/2632481/page:2/sort:plays/format:thumbnail',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
}]
|
||||||
|
_PAGE_SIZE = 100
|
||||||
|
|
||||||
def _page_url(self, base_url, pagenum):
|
def _fetch_page(self, album_id, authorizaion, hashed_pass, page):
|
||||||
return '%s/page:%d/' % (base_url, pagenum)
|
api_page = page + 1
|
||||||
|
query = {
|
||||||
|
'fields': 'link',
|
||||||
|
'page': api_page,
|
||||||
|
'per_page': self._PAGE_SIZE,
|
||||||
|
}
|
||||||
|
if hashed_pass:
|
||||||
|
query['_hashed_pass'] = hashed_pass
|
||||||
|
videos = self._download_json(
|
||||||
|
'https://api.vimeo.com/albums/%s/videos' % album_id,
|
||||||
|
album_id, 'Downloading page %d' % api_page, query=query, headers={
|
||||||
|
'Authorization': 'jwt ' + authorizaion,
|
||||||
|
})['data']
|
||||||
|
for video in videos:
|
||||||
|
link = video.get('link')
|
||||||
|
if not link:
|
||||||
|
continue
|
||||||
|
yield self.url_result(link, VimeoIE.ie_key(), VimeoIE._match_id(link))
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
album_id = self._match_id(url)
|
album_id = self._match_id(url)
|
||||||
return self._extract_videos(album_id, 'https://vimeo.com/album/%s' % album_id)
|
webpage = self._download_webpage(url, album_id)
|
||||||
|
webpage = self._login_list_password(url, album_id, webpage)
|
||||||
|
api_config = self._extract_vimeo_config(webpage, album_id)['api']
|
||||||
|
entries = OnDemandPagedList(functools.partial(
|
||||||
|
self._fetch_page, album_id, api_config['jwt'],
|
||||||
|
api_config.get('hashed_pass')), self._PAGE_SIZE)
|
||||||
|
return self.playlist_result(entries, album_id, self._html_search_regex(
|
||||||
|
r'<title>\s*(.+?)(?:\s+on Vimeo)?</title>', webpage, 'title', fatal=False))
|
||||||
|
|
||||||
|
|
||||||
class VimeoGroupsIE(VimeoAlbumIE):
|
class VimeoGroupsIE(VimeoAlbumIE):
|
||||||
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
@ -47,6 +48,10 @@ class YandexVideoIE(InfoExtractor):
|
|||||||
# episode, sports
|
# episode, sports
|
||||||
'url': 'https://yandex.ru/?stream_channel=1538487871&stream_id=4132a07f71fb0396be93d74b3477131d',
|
'url': 'https://yandex.ru/?stream_channel=1538487871&stream_id=4132a07f71fb0396be93d74b3477131d',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
# DASH with DRM
|
||||||
|
'url': 'https://yandex.ru/portal/video?from=morda&stream_id=485a92d94518d73a9d0ff778e13505f8',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -59,13 +64,22 @@ class YandexVideoIE(InfoExtractor):
|
|||||||
'disable_trackings': 1,
|
'disable_trackings': 1,
|
||||||
})['content']
|
})['content']
|
||||||
|
|
||||||
m3u8_url = url_or_none(content.get('content_url')) or url_or_none(
|
content_url = url_or_none(content.get('content_url')) or url_or_none(
|
||||||
content['streams'][0]['url'])
|
content['streams'][0]['url'])
|
||||||
title = content.get('title') or content.get('computed_title')
|
title = content.get('title') or content.get('computed_title')
|
||||||
|
|
||||||
formats = self._extract_m3u8_formats(
|
ext = determine_ext(content_url)
|
||||||
m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
|
||||||
m3u8_id='hls')
|
if ext == 'm3u8':
|
||||||
|
formats = self._extract_m3u8_formats(
|
||||||
|
content_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
|
m3u8_id='hls')
|
||||||
|
elif ext == 'mpd':
|
||||||
|
formats = self._extract_mpd_formats(
|
||||||
|
content_url, video_id, mpd_id='dash')
|
||||||
|
else:
|
||||||
|
formats = [{'url': content_url}]
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
description = content.get('description')
|
description = content.get('description')
|
||||||
|
@ -1813,7 +1813,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
def extract_unavailable_message():
|
def extract_unavailable_message():
|
||||||
return self._html_search_regex(
|
return self._html_search_regex(
|
||||||
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
|
(r'(?s)<div[^>]+id=["\']unavailable-submessage["\'][^>]+>(.+?)</div',
|
||||||
|
r'(?s)<h1[^>]+id=["\']unavailable-message["\'][^>]*>(.+?)</h1>'),
|
||||||
video_webpage, 'unavailable message', default=None)
|
video_webpage, 'unavailable message', default=None)
|
||||||
|
|
||||||
if not video_info:
|
if not video_info:
|
||||||
@ -2098,9 +2099,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
|
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
|
||||||
formats.append(a_format)
|
formats.append(a_format)
|
||||||
else:
|
else:
|
||||||
error_message = clean_html(video_info.get('reason', [None])[0])
|
error_message = extract_unavailable_message()
|
||||||
if not error_message:
|
if not error_message:
|
||||||
error_message = extract_unavailable_message()
|
error_message = clean_html(try_get(
|
||||||
|
player_response, lambda x: x['playabilityStatus']['reason'],
|
||||||
|
compat_str))
|
||||||
|
if not error_message:
|
||||||
|
error_message = clean_html(
|
||||||
|
try_get(video_info, lambda x: x['reason'][0], compat_str))
|
||||||
if error_message:
|
if error_message:
|
||||||
raise ExtractorError(error_message, expected=True)
|
raise ExtractorError(error_message, expected=True)
|
||||||
raise ExtractorError('no conn, hlsvp, hlsManifestUrl or url_encoded_fmt_stream_map information found in video info')
|
raise ExtractorError('no conn, hlsvp, hlsManifestUrl or url_encoded_fmt_stream_map information found in video info')
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = '2019.07.30'
|
__version__ = '2019.08.02'
|
||||||
|
Loading…
Reference in New Issue
Block a user