mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-21 19:03:02 +08:00
[trilulilu] Modernize
This commit is contained in:
parent
4c6d2ff8dc
commit
b3034f9df7
@ -1,28 +1,28 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class TriluliluIE(InfoExtractor):
|
class TriluliluIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?x)(?:https?://)?(?:www\.)?trilulilu\.ro/video-(?P<category>[^/]+)/(?P<video_id>[^/]+)'
|
_VALID_URL = r'https?://(?:www\.)?trilulilu\.ro/video-[^/]+/(?P<id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.trilulilu.ro/video-animatie/big-buck-bunny-1",
|
'url': 'http://www.trilulilu.ro/video-animatie/big-buck-bunny-1',
|
||||||
u'file': u"big-buck-bunny-1.mp4",
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'big-buck-bunny-1',
|
||||||
u"title": u"Big Buck Bunny",
|
'ext': 'mp4',
|
||||||
u"description": u":) pentru copilul din noi",
|
'title': 'Big Buck Bunny',
|
||||||
|
'description': ':) pentru copilul din noi',
|
||||||
},
|
},
|
||||||
# Server ignores Range headers (--test)
|
# Server ignores Range headers (--test)
|
||||||
u"params": {
|
'params': {
|
||||||
u"skip_download": True
|
'skip_download': True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
video_id = mobj.group('video_id')
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
@ -30,20 +30,20 @@ class TriluliluIE(InfoExtractor):
|
|||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
log_str = self._search_regex(
|
log_str = self._search_regex(
|
||||||
r'block_flash_vars[ ]=[ ]({[^}]+})', webpage, u'log info')
|
r'block_flash_vars[ ]=[ ]({[^}]+})', webpage, 'log info')
|
||||||
log = json.loads(log_str)
|
log = json.loads(log_str)
|
||||||
|
|
||||||
format_url = (u'http://fs%(server)s.trilulilu.ro/%(hash)s/'
|
format_url = ('http://fs%(server)s.trilulilu.ro/%(hash)s/'
|
||||||
u'video-formats2' % log)
|
'video-formats2' % log)
|
||||||
format_doc = self._download_xml(
|
format_doc = self._download_xml(
|
||||||
format_url, video_id,
|
format_url, video_id,
|
||||||
note=u'Downloading formats',
|
note='Downloading formats',
|
||||||
errnote=u'Error while downloading formats')
|
errnote='Error while downloading formats')
|
||||||
|
|
||||||
video_url_template = (
|
video_url_template = (
|
||||||
u'http://fs%(server)s.trilulilu.ro/stream.php?type=video'
|
'http://fs%(server)s.trilulilu.ro/stream.php?type=video'
|
||||||
u'&source=site&hash=%(hash)s&username=%(userid)s&'
|
'&source=site&hash=%(hash)s&username=%(userid)s&'
|
||||||
u'key=ministhebest&format=%%s&sig=&exp=' %
|
'key=ministhebest&format=%%s&sig=&exp=' %
|
||||||
log)
|
log)
|
||||||
formats = [
|
formats = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user