1
mirror of https://github.com/yt-dlp/yt-dlp synced 2024-12-15 14:35:54 +01:00

[gorillavid] Fix title extraction and make thumbnail optional (Closes #3884)

This commit is contained in:
Sergey M 2014-10-06 01:47:22 +07:00
parent bb0c206f59
commit e4b85e35d0

View File

@ -5,6 +5,7 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError,
determine_ext, determine_ext,
compat_urllib_parse, compat_urllib_parse,
compat_urllib_request, compat_urllib_request,
@ -25,7 +26,7 @@ class GorillaVidIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '06y9juieqpmi', 'id': '06y9juieqpmi',
'ext': 'flv', 'ext': 'flv',
'title': 'Rebecca Black My Moment Official Music Video Reaction', 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
'thumbnail': 're:http://.*\.jpg', 'thumbnail': 're:http://.*\.jpg',
}, },
}, { }, {
@ -72,14 +73,14 @@ class GorillaVidIE(InfoExtractor):
webpage = self._download_webpage(req, video_id, 'Downloading video page') webpage = self._download_webpage(req, video_id, 'Downloading video page')
title = self._search_regex(r'style="z-index: [0-9]+;">([0-9a-zA-Z ]+)(?:-.+)?</span>', webpage, 'title') title = self._search_regex(r'style="z-index: [0-9]+;">([^<]+)</span>', webpage, 'title')
thumbnail = self._search_regex(r'image:\'(http[^\']+)\',', webpage, 'thumbnail') video_url = self._search_regex(r'file\s*:\s*\'(http[^\']+)\',', webpage, 'file url')
url = self._search_regex(r'file: \'(http[^\']+)\',', webpage, 'file url') thumbnail = self._search_regex(r'image\s*:\s*\'(http[^\']+)\',', webpage, 'thumbnail', fatal=False)
formats = [{ formats = [{
'format_id': 'sd', 'format_id': 'sd',
'url': url, 'url': video_url,
'ext': determine_ext(url), 'ext': determine_ext(video_url),
'quality': 1, 'quality': 1,
}] }]