1
0
mirror of https://github.com/l1ving/youtube-dl synced 2026-05-28 16:30:38 +08:00

[Metube] Add a new extractor for metube.id

This commit is contained in:
Surya Oktafendri
2018-03-27 13:11:58 +07:00
Unverified
parent bbd9d8c170
commit da04fecf3c
2 changed files with 46 additions and 0 deletions
+1
View File
@@ -596,6 +596,7 @@ from .melonvod import MelonVODIE
from .meta import METAIE
from .metacafe import MetacafeIE
from .metacritic import MetacriticIE
from .metube import MetubeIE
from .mgoon import MgoonIE
from .mgtv import MGTVIE
from .miaopai import MiaoPaiIE
+45
View File
@@ -0,0 +1,45 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class MetubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?metube\.id/videos/(?P<id>\d+)/(?P<slug>[^/?#&]+)'
_TEST = {
'url': 'https://www.metube.id/videos/15090866/dragon-ball-super-eps-131',
'info_dict': {
'id': '15090866',
'slug': 'dragon-ball-super-eps-131',
'ext': 'm3u8',
'title': 'Dragon Ball Super Eps.131',
'description': 'md5:dc4bfa9274e3db15392bfce045964331',
'thumbnail': r're:^https?://.*\.jpg$',
},
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id, slug = mobj.group('id', 'slug')
webpage = self._download_webpage(url, video_id)
title = self._og_search_title(webpage)
description = self._og_search_description(webpage)
thumbnail = self._og_search_property('image', webpage)
m3u8_url = self._html_search_regex(
r'''jwplayer\s*\(\s*["'][^'"]+["']\s*\)\s*\.setup.*?['"]?file['"]?\s*:\s*["\'](.*?)["\']''',
webpage, 'm3u8_url', default='{}', fatal=False)
formats = self._extract_m3u8_formats(
m3u8_url, video_id, 'm3u8', entry_protocol='m3u8_native')
self._sort_formats(formats)
return {
'id': video_id,
'slug': slug,
'title': title,
'description': description,
'thumbnail': thumbnail,
'formats': formats
}