1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-09 23:23:32 +08:00

[Vidbit] Simplify base URL

This commit is contained in:
TRox1972 2016-06-18 20:33:57 +02:00
parent e2568ca666
commit dd49ab150e

View File

@ -5,6 +5,8 @@ import re
from .common import InfoExtractor
from ..utils import url_basename
from ..compat import compat_urlparse
class VidbitIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vidbit\.co/watch\?v=(?P<id>[\w-]+)'
@ -23,12 +25,10 @@ class VidbitIE(InfoExtractor):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
_BASE_URL = 'http://' + url.split('/')[2] + '/'
return {
'id': video_id,
'title': self._html_search_regex(r'<h1>(.+)</h1>', webpage, 'title'),
'url': _BASE_URL + self._html_search_regex(r'file:\s*(["\'])((?:(?!\1).)+)\1', webpage, 'video URL', group=2),
'thumbnail': _BASE_URL + self._html_search_regex(r'image:\s*(["\'])((?:(?!\1).)+)\1', webpage, 'thumbnail', None, group=2),
'url': compat_urlparse.urljoin(url, self._html_search_regex(r'file:\s*(["\'])((?:(?!\1).)+)\1', webpage, 'video URL', group=2)),
'thumbnail': compat_urlparse.urljoin(url, self._html_search_regex(r'image:\s*(["\'])((?:(?!\1).)+)\1', webpage, 'thumbnail', None, group=2)),
'description': self._html_search_regex(r'description:(["\'])((?:(?!\1).)+)\1', webpage, 'description', None, group=2),
}