1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-27 19:04:32 +01:00

finished dropout extractor

This commit is contained in:
Thomas Tsiakalakis 2019-02-20 18:58:00 +01:00
parent f749ac67ab
commit 7781e2710d

View File

@ -1,14 +1,13 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor
from .vimeo import VHXEmbedIE from .vimeo import VHXEmbedIE
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
sanitized_Request, sanitized_Request,
urlencode_postdata urlencode_postdata,
RegexNotFoundError
) )
import re import re
@ -31,9 +30,10 @@ import re
class IntlDropoutIE(VHXEmbedIE): class IntlDropoutIE(VHXEmbedIE):
IE_DESC = 'International Dropout.tv'
_LOGIN_URL = 'https://intl.dropout.tv/login' _LOGIN_URL = 'https://intl.dropout.tv/login'
_LOGOUT_URL = 'https://intl.dropout.tv/logout' _LOGOUT_URL = 'https://intl.dropout.tv/logout'
_VALID_URL = r'https://intl\.dropout\.tv/(?P<id>[^/]+/.+)' _VALID_URL = r'https://intl\.dropout\.tv/(?P<id>.+)'
_TEST = { _TEST = {
'url': 'https://intl.dropout.tv/um-actually/season:1/videos/c-3po-s-origins-hp-lovecraft-the-food-album-with-weird-al-yankovic', 'url': 'https://intl.dropout.tv/um-actually/season:1/videos/c-3po-s-origins-hp-lovecraft-the-food-album-with-weird-al-yankovic',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
@ -87,15 +87,12 @@ class IntlDropoutIE(VHXEmbedIE):
def _real_extract(self, url): def _real_extract(self, url):
webpage = self._download_webpage(url, None) webpage = self._download_webpage(url, None)
embed = self._html_search_regex(r'<iframe[^>]+"(?P<embed>https://embed.vhx.tv/videos/[0-9]+[^"]*)"[^>]*>', webpage, 'embed') try:
video = self._html_search_regex(r'<iframe[^>]+"(?P<embed>https://embed.vhx.tv/videos/[0-9]+[^"]*)"[^>]*>', webpage, 'embed')
print(embed) except RegexNotFoundError:
items = re.findall(r'<a href="(?P<url>https://intl.dropout.tv/videos/[^"]+)"', webpage)
self._download_webpage( playlist_id = self._search_regex(r'https://intl.dropout.tv/(?P<id>.+)', url, 'id')
self._LOGOUT_URL, None, playlist_title = self._html_search_regex(r'<h1 class="[^"]*collection-title[^"]*"[^>]*>(?P<title>[^<]+)<', webpage, 'title')
note='logging out', return self.playlist_from_matches(items, playlist_id=playlist_id, playlist_title=playlist_title)
errnote='unable to logout', fatal=False
)
return self.url_result(embed)
return self.url_result(video)