mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-29 22:24:25 +01:00
[trilulilu] Add support for trilulilu.ro
Fun fact: The ads (not yet supported) are loaded from youtube ;)
This commit is contained in:
parent
c3b7b29c23
commit
341ca8d74c
2 changed files with 79 additions and 2 deletions
|
@ -6,6 +6,7 @@ from .bandcamp import BandcampIE
|
|||
from .bliptv import BlipTVIE, BlipTVUserIE
|
||||
from .breakcom import BreakIE
|
||||
from .brightcove import BrightcoveIE
|
||||
from .c56 import C56IE
|
||||
from .canalplus import CanalplusIE
|
||||
from .collegehumor import CollegeHumorIE
|
||||
from .comedycentral import ComedyCentralIE
|
||||
|
@ -73,18 +74,18 @@ from .ted import TEDIE
|
|||
from .tf1 import TF1IE
|
||||
from .thisav import ThisAVIE
|
||||
from .traileraddict import TrailerAddictIE
|
||||
from .trilulilu import TriluliluIE
|
||||
from .tudou import TudouIE
|
||||
from .tumblr import TumblrIE
|
||||
from .tutv import TutvIE
|
||||
from .ustream import UstreamIE
|
||||
from .unistra import UnistraIE
|
||||
from .ustream import UstreamIE
|
||||
from .vbox7 import Vbox7IE
|
||||
from .veoh import VeohIE
|
||||
from .vevo import VevoIE
|
||||
from .videofyme import VideofyMeIE
|
||||
from .vimeo import VimeoIE, VimeoChannelIE
|
||||
from .vine import VineIE
|
||||
from .c56 import C56IE
|
||||
from .wat import WatIE
|
||||
from .weibo import WeiboIE
|
||||
from .wimp import WimpIE
|
||||
|
|
76
youtube_dl/extractor/trilulilu.py
Normal file
76
youtube_dl/extractor/trilulilu.py
Normal file
|
@ -0,0 +1,76 @@
|
|||
import json
|
||||
import re
|
||||
import xml.etree.ElementTree
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
)
|
||||
|
||||
|
||||
class TriluliluIE(InfoExtractor):
|
||||
_VALID_URL = r'(?x)(?:https?://)?(?:www\.)?trilulilu\.ro/video-(?P<category>[^/]+)/(?P<video_id>[^/]+)'
|
||||
_TEST = {
|
||||
u"url": u"http://www.trilulilu.ro/video-animatie/big-buck-bunny-1",
|
||||
u'file': u"big-buck-bunny-1.mp4",
|
||||
u'info_dict': {
|
||||
u"title": u"Big Buck Bunny",
|
||||
u"description": u":) pentru copilul din noi",
|
||||
},
|
||||
# Server ignores Range headers (--test)
|
||||
u"params": {
|
||||
u"skip_download": True
|
||||
}
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
video_id = mobj.group('video_id')
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
title = self._og_search_title(webpage)
|
||||
thumbnail = self._og_search_thumbnail(webpage)
|
||||
description = self._og_search_description(webpage)
|
||||
|
||||
log_str = self._search_regex(
|
||||
r'block_flash_vars[ ]=[ ]({[^}]+})', webpage, u'log info')
|
||||
log = json.loads(log_str)
|
||||
|
||||
format_url = (u'http://fs%(server)s.trilulilu.ro/%(hash)s/'
|
||||
u'video-formats2' % log)
|
||||
format_str = self._download_webpage(
|
||||
format_url, video_id,
|
||||
note=u'Downloading formats',
|
||||
errnote=u'Error while downloading formats')
|
||||
|
||||
format_doc = xml.etree.ElementTree.fromstring(format_str)
|
||||
|
||||
video_url_template = (
|
||||
u'http://fs%(server)s.trilulilu.ro/stream.php?type=video'
|
||||
u'&source=site&hash=%(hash)s&username=%(userid)s&'
|
||||
u'key=ministhebest&format=%%s&sig=&exp=' %
|
||||
log)
|
||||
formats = [
|
||||
{
|
||||
'format': fnode.text,
|
||||
'url': video_url_template % fnode.text,
|
||||
}
|
||||
|
||||
for fnode in format_doc.findall('./formats/format')
|
||||
]
|
||||
|
||||
info = {
|
||||
'_type': 'video',
|
||||
'id': video_id,
|
||||
'formats': formats,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'thumbnail': thumbnail,
|
||||
}
|
||||
|
||||
# TODO: Remove when #980 has been merged
|
||||
info['url'] = formats[-1]['url']
|
||||
info['ext'] = formats[-1]['format'].partition('-')[0]
|
||||
|
||||
return info
|
Loading…
Reference in a new issue