1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

[Northpoint] Add new extractor

This commit is contained in:
Marek Chowaniok 2018-10-24 15:36:34 -03:00
parent ff2e3e38be
commit b4746dd629

View File

@ -1,20 +1,19 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor
from .theplatform import ThePlatformIE from .theplatform import ThePlatformIE
class NorthpointIE(ThePlatformIE): class NorthpointIE(ThePlatformIE):
_VALID_URL = r'(?:http?://)?(?:www\.)?northpoint\.org/messages/[^/]+/(?P<id>[^/]+)' _VALID_URL = r'(?:http?://)?(?:www\.)?northpoint\.org/messages/[^/]+/(?P<id>[^/]+)'
_TESTS =[ { _TESTS = [{
'url': 'http://northpoint.org/messages/three-things/what-makes-you-a-wonder/', 'url': 'http://northpoint.org/messages/three-things/what-makes-you-a-wonder/',
'md5': '214af23fa75d0fae44298a5128c35d56', 'md5': '214af23fa75d0fae44298a5128c35d56',
'info_dict': { 'info_dict': {
'id': 'rosH7wGAB33s', 'id': 'rosH7wGAB33s',
'ext': 'mp4', 'ext': 'mp4',
'title': "Three Things I Learned from a Movie I Didn't Want to See - The Power Of Friendship", 'title': "Three Things I Learned from a Movie I Didn't Want to See - The Power Of Friendship",
'series': "Three Things I Learned from a Movie I Didn't Want to See", 'series': "Three Things I Learned from a Movie I Didn't Want to See",
} }
}] }]
@ -22,10 +21,9 @@ class NorthpointIE(ThePlatformIE):
display_id = self._match_id(url) display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
playerCode = self._search_regex(r'playerCode\s*=\s*[\'"]([^\'"]+)',webpage, 'player Code') playerCode = self._search_regex(r'playerCode\s*=\s*[\'"]([^\'"]+)', webpage, 'player Code')
seriesPermalink = self._search_regex(r'series_permalink\s*:\s*[\'"]([^\'"]+)',webpage, 'series name') seriesPermalink = self._search_regex(r'series_permalink\s*:\s*[\'"]([^\'"]+)', webpage, 'series name')
seriesJSON = self._download_json( seriesJSON = self._download_json('http://northpoint.org/api/mma/details/channel/npcc/permalink/%s' % seriesPermalink, display_id)['messages']
'http://northpoint.org/api/mma/details/channel/npcc/permalink/%s' %seriesPermalink,display_id)['messages']
videoIDLink = '' videoIDLink = ''
videoIDLinkTemp = '' videoIDLinkTemp = ''
@ -37,22 +35,18 @@ class NorthpointIE(ThePlatformIE):
if not videoIDLink: if not videoIDLink:
videoIDLink = videoIDLinkTemp videoIDLink = videoIDLinkTemp
linkWebpage = self._download_webpage('http://player.theplatform.com/p/IfSiAC/'+playerCode+'/embed/select/'+videoIDLink, display_id) linkWebpage = self._download_webpage('http://player.theplatform.com/p/IfSiAC/' + playerCode + '/embed/select/' + videoIDLink, display_id)
releaseUrl = self._search_regex(r'tp:releaseUrl\s*=\s*[\'"]([^\'"]+)',linkWebpage, 'release url') releaseUrl = self._search_regex(r'tp:releaseUrl\s*=\s*[\'"]([^\'"]+)', linkWebpage, 'release url')
platformMetaData = self._search_regex(r'.*.com\/s\/\s*([^\n\r]*)[ˆ?]',releaseUrl, 'release url') platformMetaData = self._search_regex(r'.*.com\/s\/\s*([^\n\r]*)[ˆ?]', releaseUrl, 'release url')
theplatform_metadata = self._download_theplatform_metadata(platformMetaData, display_id) theplatform_metadata = self._download_theplatform_metadata(platformMetaData, display_id)
# print theplatform_metadata
video_id = theplatform_metadata['pid'] video_id = theplatform_metadata['pid']
title = theplatform_metadata['title'][19:] title = theplatform_metadata['title'][19:]
series = theplatform_metadata['pl1$seriesName'] series = theplatform_metadata['pl1$seriesName']
# print title, series
formats, subtitles = self._extract_theplatform_smil(releaseUrl, video_id) formats, subtitles = self._extract_theplatform_smil(releaseUrl, video_id)
self._sort_formats(formats) self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,