Skip to content

Commit

Permalink
[nrk:playlist] Add extractor (Closes #5245)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Mar 21, 2015
1 parent 393d9fc commit faa1b5c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions youtube_dl/extractor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@
)
from .nrk import (
NRKIE,
NRKPlaylistIE,
NRKTVIE,
)
from .ntvde import NTVDeIE
Expand Down
31 changes: 31 additions & 0 deletions youtube_dl/extractor/nrk.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,37 @@ def _real_extract(self, url):
}


class NRKPlaylistIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?nrk\.no/(?:[^/]+/)*(?P<id>[^/]+)'

_TEST = {
'url': 'http://www.nrk.no/troms/gjenopplev-den-historiske-solformorkelsen-1.12270763',
'info_dict': {
'id': 'gjenopplev-den-historiske-solformorkelsen-1.12270763',
'title': 'Gjenopplev den historiske solformørkelsen',
'description': 'md5:c2df8ea3bac5654a26fc2834a542feed',
},
'playlist_mincount': 2,
}

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, 'NRK')
for video_id in re.findall(
r'class="[^"]*\brich\b[^"]*"[^>]+data-video-id="(\d+)"', webpage)
]

playlist_title = self._og_search_title(webpage)
playlist_description = self._og_search_description(webpage)

return self.playlist_result(
entries, playlist_id, playlist_title, playlist_description)


class NRKTVIE(InfoExtractor):
_VALID_URL = r'(?P<baseurl>http://tv\.nrk(?:super)?\.no/)(?:serie/[^/]+|program)/(?P<id>[a-zA-Z]{4}\d{8})(?:/\d{2}-\d{2}-\d{4})?(?:#del=(?P<part_id>\d+))?'

Expand Down

0 comments on commit faa1b5c

Please sign in to comment.