Compare commits
12 Commits
2016.12.31
...
2017.01.02
Author | SHA1 | Date | |
---|---|---|---|
|
2021b650dd | ||
|
b890caaf21 | ||
|
3783a5ccba | ||
|
327caf661a | ||
|
ce7ccb1caa | ||
|
295eac6165 | ||
|
d546d4c8e0 | ||
|
eec45445a8 | ||
|
7fc06b6a15 | ||
|
966815e139 | ||
|
e5e19379be | ||
|
1f766b6e7b |
8
.github/ISSUE_TEMPLATE.md
vendored
8
.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 *2016.12.22*. 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 *2017.01.02*. 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 **2016.12.22**
|
- [ ] I've **verified** and **I assure** that I'm running youtube-dl **2017.01.02**
|
||||||
|
|
||||||
### Before submitting an *issue* make sure you have:
|
### Before submitting an *issue* make sure you have:
|
||||||
- [ ] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
|
- [ ] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
|
||||||
@@ -35,7 +35,7 @@ $ youtube-dl -v <your command line>
|
|||||||
[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 2016.12.22
|
[debug] youtube-dl version 2017.01.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: {}
|
||||||
@@ -50,6 +50,8 @@ $ youtube-dl -v <your command line>
|
|||||||
- Single video: https://youtu.be/BaW_jenozKc
|
- Single video: https://youtu.be/BaW_jenozKc
|
||||||
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
||||||
|
|
||||||
|
Note that **youtube-dl does not support sites dedicated to [copyright infringement](https://github.com/rg3/youtube-dl#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free)**. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Description of your *issue*, suggested solution and other information
|
### Description of your *issue*, suggested solution and other information
|
||||||
|
2
.github/ISSUE_TEMPLATE_tmpl.md
vendored
2
.github/ISSUE_TEMPLATE_tmpl.md
vendored
@@ -50,6 +50,8 @@ $ youtube-dl -v <your command line>
|
|||||||
- Single video: https://youtu.be/BaW_jenozKc
|
- Single video: https://youtu.be/BaW_jenozKc
|
||||||
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
||||||
|
|
||||||
|
Note that **youtube-dl does not support sites dedicated to [copyright infringement](https://github.com/rg3/youtube-dl#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free)**. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Description of your *issue*, suggested solution and other information
|
### Description of your *issue*, suggested solution and other information
|
||||||
|
@@ -94,7 +94,7 @@ If you want to create a build of youtube-dl yourself, you'll need
|
|||||||
|
|
||||||
If you want to add support for a new site, first of all **make sure** this site is **not dedicated to [copyright infringement](README.md#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free)**. youtube-dl does **not support** such sites thus pull requests adding support for them **will be rejected**.
|
If you want to add support for a new site, first of all **make sure** this site is **not dedicated to [copyright infringement](README.md#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free)**. youtube-dl does **not support** such sites thus pull requests adding support for them **will be rejected**.
|
||||||
|
|
||||||
After you have ensured this site is distributing it's content legally, you can follow this quick list (assuming your service is called `yourextractor`):
|
After you have ensured this site is distributing its content legally, you can follow this quick list (assuming your service is called `yourextractor`):
|
||||||
|
|
||||||
1. [Fork this repository](https://github.com/rg3/youtube-dl/fork)
|
1. [Fork this repository](https://github.com/rg3/youtube-dl/fork)
|
||||||
2. Check out the source code with:
|
2. Check out the source code with:
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
version 2017.01.02
|
||||||
|
|
||||||
|
Extractors
|
||||||
|
* [cctv] Improve extraction (#879, #6753, #8541)
|
||||||
|
+ [nrktv:episodes] Add support for episodes (#11571)
|
||||||
|
+ [arkena] Add support for video.arkena.com (#11568)
|
||||||
|
|
||||||
|
|
||||||
version 2016.12.31
|
version 2016.12.31
|
||||||
|
|
||||||
Core
|
Core
|
||||||
|
@@ -29,7 +29,7 @@ Windows users can [download an .exe file](https://yt-dl.org/latest/youtube-dl.ex
|
|||||||
|
|
||||||
You can also use pip:
|
You can also use pip:
|
||||||
|
|
||||||
sudo pip install --upgrade youtube-dl
|
sudo -H pip install --upgrade youtube-dl
|
||||||
|
|
||||||
This command will update youtube-dl if you have already installed it. See the [pypi page](https://pypi.python.org/pypi/youtube_dl) for more information.
|
This command will update youtube-dl if you have already installed it. See the [pypi page](https://pypi.python.org/pypi/youtube_dl) for more information.
|
||||||
|
|
||||||
@@ -1148,7 +1148,7 @@ with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
|||||||
ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
|
ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
|
||||||
```
|
```
|
||||||
|
|
||||||
Most likely, you'll want to use various options. For a list of options available, have a look at [`youtube_dl/YoutubeDL.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L128-L278). For a start, if you want to intercept youtube-dl's output, set a `logger` object.
|
Most likely, you'll want to use various options. For a list of options available, have a look at [`youtube_dl/YoutubeDL.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L129-L279). For a start, if you want to intercept youtube-dl's output, set a `logger` object.
|
||||||
|
|
||||||
Here's a more complete example of a program that outputs only errors (and a short message after the download is finished), and downloads/converts the video to an mp3 file:
|
Here's a more complete example of a program that outputs only errors (and a short message after the download is finished), and downloads/converts the video to an mp3 file:
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@
|
|||||||
- **cbsnews:livevideo**: CBS News Live Videos
|
- **cbsnews:livevideo**: CBS News Live Videos
|
||||||
- **CBSSports**
|
- **CBSSports**
|
||||||
- **CCMA**
|
- **CCMA**
|
||||||
- **CCTV**
|
- **CCTV**: 央视网
|
||||||
- **CDA**
|
- **CDA**
|
||||||
- **CeskaTelevize**
|
- **CeskaTelevize**
|
||||||
- **channel9**: Channel 9
|
- **channel9**: Channel 9
|
||||||
@@ -517,6 +517,7 @@
|
|||||||
- **NRKSkole**: NRK Skole
|
- **NRKSkole**: NRK Skole
|
||||||
- **NRKTV**: NRK TV and NRK Radio
|
- **NRKTV**: NRK TV and NRK Radio
|
||||||
- **NRKTVDirekte**: NRK TV Direkte and NRK Radio Direkte
|
- **NRKTVDirekte**: NRK TV Direkte and NRK Radio Direkte
|
||||||
|
- **NRKTVEpisodes**
|
||||||
- **ntv.ru**
|
- **ntv.ru**
|
||||||
- **Nuvid**
|
- **Nuvid**
|
||||||
- **NYTimes**
|
- **NYTimes**
|
||||||
|
@@ -4,8 +4,10 @@ from __future__ import unicode_literals
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_urlparse
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
@@ -15,7 +17,13 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class ArkenaIE(InfoExtractor):
|
class ArkenaIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://play\.arkena\.com/(?:config|embed)/avp/v\d/player/media/(?P<id>[^/]+)/[^/]+/(?P<account_id>\d+)'
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://
|
||||||
|
(?:
|
||||||
|
video\.arkena\.com/play2/embed/player\?|
|
||||||
|
play\.arkena\.com/(?:config|embed)/avp/v\d/player/media/(?P<id>[^/]+)/[^/]+/(?P<account_id>\d+)
|
||||||
|
)
|
||||||
|
'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://play.arkena.com/embed/avp/v2/player/media/b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe/1/129411',
|
'url': 'https://play.arkena.com/embed/avp/v2/player/media/b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe/1/129411',
|
||||||
'md5': 'b96f2f71b359a8ecd05ce4e1daa72365',
|
'md5': 'b96f2f71b359a8ecd05ce4e1daa72365',
|
||||||
@@ -37,6 +45,9 @@ class ArkenaIE(InfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'http://play.arkena.com/embed/avp/v1/player/media/327336/darkmatter/131064/',
|
'url': 'http://play.arkena.com/embed/avp/v1/player/media/327336/darkmatter/131064/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://video.arkena.com/play2/embed/player?accountId=472718&mediaId=35763b3b-00090078-bf604299&pageStyling=styled',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -53,6 +64,14 @@ class ArkenaIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
account_id = mobj.group('account_id')
|
account_id = mobj.group('account_id')
|
||||||
|
|
||||||
|
# Handle http://video.arkena.com/play2/embed/player URL
|
||||||
|
if not video_id:
|
||||||
|
qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
||||||
|
video_id = qs.get('mediaId', [None])[0]
|
||||||
|
account_id = qs.get('accountId', [None])[0]
|
||||||
|
if not video_id or not account_id:
|
||||||
|
raise ExtractorError('Invalid URL', expected=True)
|
||||||
|
|
||||||
playlist = self._download_json(
|
playlist = self._download_json(
|
||||||
'https://play.arkena.com/config/avp/v2/player/media/%s/0/%s/?callbackMethod=_'
|
'https://play.arkena.com/config/avp/v2/player/media/%s/0/%s/?callbackMethod=_'
|
||||||
% (video_id, account_id),
|
% (video_id, account_id),
|
||||||
|
@@ -4,27 +4,84 @@ from __future__ import unicode_literals
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import float_or_none
|
from ..compat import compat_str
|
||||||
|
from ..utils import (
|
||||||
|
float_or_none,
|
||||||
|
try_get,
|
||||||
|
unified_timestamp,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CCTVIE(InfoExtractor):
|
class CCTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'''(?x)https?://(?:.+?\.)?
|
IE_DESC = '央视网'
|
||||||
(?:
|
_VALID_URL = r'https?://(?:[^/]+)\.(?:cntv|cctv)\.(?:com|cn)/(?:[^/]+/)*?(?P<id>[^/?#&]+?)(?:/index)?(?:\.s?html|[?#&]|$)'
|
||||||
cctv\.(?:com|cn)|
|
|
||||||
cntv\.cn
|
|
||||||
)/
|
|
||||||
(?:
|
|
||||||
video/[^/]+/(?P<id>[0-9a-f]{32})|
|
|
||||||
\d{4}/\d{2}/\d{2}/(?P<display_id>VID[0-9A-Za-z]+)
|
|
||||||
)'''
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://english.cntv.cn/2016/09/03/VIDEhnkB5y9AgHyIEVphCEz1160903.shtml',
|
'url': 'http://sports.cntv.cn/2016/02/12/ARTIaBRxv4rTT1yWf1frW2wi160212.shtml',
|
||||||
'md5': '819c7b49fc3927d529fb4cd555621823',
|
'md5': 'd61ec00a493e09da810bf406a078f691',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '454368eb19ad44a1925bf1eb96140a61',
|
'id': '5ecdbeab623f4973b40ff25f18b174e8',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Portrait of Real Current Life 09/03/2016 Modern Inventors Part 1',
|
'title': '[NBA]二少联手砍下46分 雷霆主场击败鹈鹕(快讯)',
|
||||||
}
|
'description': 'md5:7e14a5328dc5eb3d1cd6afbbe0574e95',
|
||||||
|
'duration': 98,
|
||||||
|
'uploader': 'songjunjie',
|
||||||
|
'timestamp': 1455279956,
|
||||||
|
'upload_date': '20160212',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://tv.cctv.com/2016/02/05/VIDEUS7apq3lKrHG9Dncm03B160205.shtml',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'efc5d49e5b3b4ab2b34f3a502b73d3ae',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '[赛车]“车王”舒马赫恢复情况成谜(快讯)',
|
||||||
|
'description': '2月4日,蒙特泽莫罗透露了关于“车王”舒马赫恢复情况,但情况是否属实遭到了质疑。',
|
||||||
|
'duration': 37,
|
||||||
|
'uploader': 'shujun',
|
||||||
|
'timestamp': 1454677291,
|
||||||
|
'upload_date': '20160205',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://english.cntv.cn/special/four_comprehensives/index.shtml',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '4bb9bb4db7a6471ba85fdeda5af0381e',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'NHnews008 ANNUAL POLITICAL SEASON',
|
||||||
|
'description': 'Four Comprehensives',
|
||||||
|
'duration': 60,
|
||||||
|
'uploader': 'zhangyunlei',
|
||||||
|
'timestamp': 1425385521,
|
||||||
|
'upload_date': '20150303',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://cctv.cntv.cn/lm/tvseries_russian/yilugesanghua/index.shtml',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'b15f009ff45c43968b9af583fc2e04b2',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Путь,усыпанный космеями Серия 1',
|
||||||
|
'description': 'Путь, усыпанный космеями',
|
||||||
|
'duration': 2645,
|
||||||
|
'uploader': 'renxue',
|
||||||
|
'timestamp': 1477479241,
|
||||||
|
'upload_date': '20161026',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://ent.cntv.cn/2016/01/18/ARTIjprSSJH8DryTVr5Bx8Wb160118.shtml',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://tv.cntv.cn/video/C39296/e0210d949f113ddfb38d31f00a4e5c44',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://english.cntv.cn/2016/09/03/VIDEhnkB5y9AgHyIEVphCEz1160903.shtml',
|
||||||
|
'only_matching': True,
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://tv.cctv.com/2016/09/07/VIDE5C1FnlX5bUywlrjhxXOV160907.shtml',
|
'url': 'http://tv.cctv.com/2016/09/07/VIDE5C1FnlX5bUywlrjhxXOV160907.shtml',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@@ -34,20 +91,63 @@ class CCTVIE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id, display_id = re.match(self._VALID_URL, url).groups()
|
video_id = self._match_id(url)
|
||||||
if not video_id:
|
webpage = self._download_webpage(url, video_id)
|
||||||
webpage = self._download_webpage(url, display_id)
|
|
||||||
video_id = self._search_regex(
|
video_id = self._search_regex(
|
||||||
r'(?:fo\.addVariable\("videoCenterId",\s*|guid\s*=\s*)"([0-9a-f]{32})',
|
[r'var\s+guid\s*=\s*["\']([\da-fA-F]+)',
|
||||||
webpage, 'video_id')
|
r'videoCenterId["\']\s*,\s*["\']([\da-fA-F]+)',
|
||||||
api_data = self._download_json(
|
r'"changePlayer\s*\(\s*["\']([\da-fA-F]+)',
|
||||||
'http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' + video_id, video_id)
|
r'"load[Vv]ideo\s*\(\s*["\']([\da-fA-F]+)'],
|
||||||
m3u8_url = re.sub(r'maxbr=\d+&?', '', api_data['hls_url'])
|
webpage, 'video id')
|
||||||
|
|
||||||
|
data = self._download_json(
|
||||||
|
'http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do', video_id,
|
||||||
|
query={
|
||||||
|
'pid': video_id,
|
||||||
|
'url': url,
|
||||||
|
'idl': 32,
|
||||||
|
'idlr': 32,
|
||||||
|
'modifyed': 'false',
|
||||||
|
})
|
||||||
|
|
||||||
|
title = data['title']
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
|
||||||
|
video = data.get('video')
|
||||||
|
if isinstance(video, dict):
|
||||||
|
for quality, chapters_key in enumerate(('lowChapters', 'chapters')):
|
||||||
|
video_url = try_get(
|
||||||
|
video, lambda x: x[chapters_key][0]['url'], compat_str)
|
||||||
|
if video_url:
|
||||||
|
formats.append({
|
||||||
|
'url': video_url,
|
||||||
|
'format_id': 'http',
|
||||||
|
'quality': quality,
|
||||||
|
'preference': -1,
|
||||||
|
})
|
||||||
|
|
||||||
|
hls_url = try_get(data, lambda x: x['hls_url'], compat_str)
|
||||||
|
if hls_url:
|
||||||
|
hls_url = re.sub(r'maxbr=\d+&?', '', hls_url)
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
hls_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
uploader = data.get('editer_name')
|
||||||
|
description = self._html_search_meta('description', webpage)
|
||||||
|
timestamp = unified_timestamp(data.get('f_pgmtime'))
|
||||||
|
duration = float_or_none(try_get(video, lambda x: x['totalLength']))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': api_data['title'],
|
'title': title,
|
||||||
'formats': self._extract_m3u8_formats(
|
'description': description,
|
||||||
m3u8_url, video_id, 'mp4', 'm3u8_native', fatal=False),
|
'uploader': uploader,
|
||||||
'duration': float_or_none(api_data.get('video', {}).get('totalLength')),
|
'timestamp': timestamp,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
@@ -655,6 +655,7 @@ from .nrk import (
|
|||||||
NRKSkoleIE,
|
NRKSkoleIE,
|
||||||
NRKTVIE,
|
NRKTVIE,
|
||||||
NRKTVDirekteIE,
|
NRKTVDirekteIE,
|
||||||
|
NRKTVEpisodesIE,
|
||||||
)
|
)
|
||||||
from .ntvde import NTVDeIE
|
from .ntvde import NTVDeIE
|
||||||
from .ntvru import NTVRuIE
|
from .ntvru import NTVRuIE
|
||||||
|
@@ -207,7 +207,15 @@ class NRKIE(NRKBaseIE):
|
|||||||
|
|
||||||
class NRKTVIE(NRKBaseIE):
|
class NRKTVIE(NRKBaseIE):
|
||||||
IE_DESC = 'NRK TV and NRK Radio'
|
IE_DESC = 'NRK TV and NRK Radio'
|
||||||
_VALID_URL = r'https?://(?:tv|radio)\.nrk(?:super)?\.no/(?:serie/[^/]+|program)/(?P<id>[a-zA-Z]{4}\d{8})(?:/\d{2}-\d{2}-\d{4})?(?:#del=(?P<part_id>\d+))?'
|
_EPISODE_RE = r'(?P<id>[a-zA-Z]{4}\d{8})'
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://
|
||||||
|
(?:tv|radio)\.nrk(?:super)?\.no/
|
||||||
|
(?:serie/[^/]+|program)/
|
||||||
|
(?![Ee]pisodes)%s
|
||||||
|
(?:/\d{2}-\d{2}-\d{4})?
|
||||||
|
(?:\#del=(?P<part_id>\d+))?
|
||||||
|
''' % _EPISODE_RE
|
||||||
_API_HOST = 'psapi-we.nrk.no'
|
_API_HOST = 'psapi-we.nrk.no'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@@ -286,9 +294,30 @@ class NRKTVDirekteIE(NRKTVIE):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
class NRKPlaylistIE(InfoExtractor):
|
class NRKPlaylistBaseIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?nrk\.no/(?!video|skole)(?:[^/]+/)+(?P<id>[^/]+)'
|
def _extract_description(self, webpage):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
|
||||||
|
entries = [
|
||||||
|
self.url_result('nrk:%s' % video_id, NRKIE.ie_key())
|
||||||
|
for video_id in re.findall(self._ITEM_RE, webpage)
|
||||||
|
]
|
||||||
|
|
||||||
|
playlist_title = self. _extract_title(webpage)
|
||||||
|
playlist_description = self._extract_description(webpage)
|
||||||
|
|
||||||
|
return self.playlist_result(
|
||||||
|
entries, playlist_id, playlist_title, playlist_description)
|
||||||
|
|
||||||
|
|
||||||
|
class NRKPlaylistIE(NRKPlaylistBaseIE):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?nrk\.no/(?!video|skole)(?:[^/]+/)+(?P<id>[^/]+)'
|
||||||
|
_ITEM_RE = r'class="[^"]*\brich\b[^"]*"[^>]+data-video-id="([^"]+)"'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.nrk.no/troms/gjenopplev-den-historiske-solformorkelsen-1.12270763',
|
'url': 'http://www.nrk.no/troms/gjenopplev-den-historiske-solformorkelsen-1.12270763',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -307,23 +336,28 @@ class NRKPlaylistIE(InfoExtractor):
|
|||||||
'playlist_count': 5,
|
'playlist_count': 5,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _extract_title(self, webpage):
|
||||||
playlist_id = self._match_id(url)
|
return self._og_search_title(webpage, fatal=False)
|
||||||
|
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
def _extract_description(self, webpage):
|
||||||
|
return self._og_search_description(webpage)
|
||||||
|
|
||||||
entries = [
|
|
||||||
self.url_result('nrk:%s' % video_id, 'NRK')
|
|
||||||
for video_id in re.findall(
|
|
||||||
r'class="[^"]*\brich\b[^"]*"[^>]+data-video-id="([^"]+)"',
|
|
||||||
webpage)
|
|
||||||
]
|
|
||||||
|
|
||||||
playlist_title = self._og_search_title(webpage)
|
class NRKTVEpisodesIE(NRKPlaylistBaseIE):
|
||||||
playlist_description = self._og_search_description(webpage)
|
_VALID_URL = r'https?://tv\.nrk\.no/program/[Ee]pisodes/[^/]+/(?P<id>\d+)'
|
||||||
|
_ITEM_RE = r'data-episode=["\']%s' % NRKTVIE._EPISODE_RE
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://tv.nrk.no/program/episodes/nytt-paa-nytt/69031',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '69031',
|
||||||
|
'title': 'Nytt på nytt, sesong: 201210',
|
||||||
|
},
|
||||||
|
'playlist_count': 4,
|
||||||
|
}]
|
||||||
|
|
||||||
return self.playlist_result(
|
def _extract_title(self, webpage):
|
||||||
entries, playlist_id, playlist_title, playlist_description)
|
return self._html_search_regex(
|
||||||
|
r'<h1>([^<]+)</h1>', webpage, 'title', fatal=False)
|
||||||
|
|
||||||
|
|
||||||
class NRKSkoleIE(InfoExtractor):
|
class NRKSkoleIE(InfoExtractor):
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = '2016.12.31'
|
__version__ = '2017.01.02'
|
||||||
|
Reference in New Issue
Block a user