48 lines
1.8 KiB
Python
Raw Normal View History

2020-02-25 20:39:54 +00:00
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
2020-02-25 21:15:11 +00:00
from ..utils import determine_ext
import re
2020-02-25 20:39:54 +00:00
class AirVuzIE(InfoExtractor):
2020-02-25 21:15:11 +00:00
_VALID_URL = r'https?://(?:www\.)?airvuz\.com/video/(?P<display_id>.+)\?id=(?P<id>.+)'
2020-02-25 20:39:54 +00:00
_TEST = {
'url': 'https://www.airvuz.com/video/An-Imaginary-World?id=599e85c49282a717c50f2f7a',
'info_dict': {
'id': '599e85c49282a717c50f2f7a',
2020-02-25 21:15:11 +00:00
'display_id': 'An-Imaginary-World',
2020-02-25 20:39:54 +00:00
'title': 'md5:7fc56270e7a70fa81a5935b72eacbe29',
2020-02-25 21:15:11 +00:00
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
2020-02-25 20:39:54 +00:00
},
}
def _real_extract(self, url):
2020-02-25 21:15:11 +00:00
groups = re.match(self._VALID_URL, url)
video_id = groups.group('id')
display_id = groups.group('display_id')
2020-02-25 20:39:54 +00:00
webpage = self._download_webpage(url, video_id)
2020-02-25 21:15:11 +00:00
title = self._og_search_title(webpage)
thumbnail = self._og_search_thumbnail(webpage)
description = self._og_search_description(webpage)
uploader = self._html_search_regex(r'class=(?:\'img-circle\'|"img-circle"|img-circle)[^>]+?alt=(?:"([^"]+?)"|\'([^\']+?)\'|([^\s"\'=<>`]+))', webpage, 'uploader', fatal=False) or self._html_search_regex(r'https?://(?:www\.)?airvuz\.com/user/([^>]*)', webpage, 'uploader', fatal=False)
2020-02-25 20:39:54 +00:00
video_url = self._html_search_regex(r'<meta[^>]+?(?:name|property)=(?:\'og:video:url\'|"og:video:url"|og:video:url)[^>]+?content=(?:"([^"]+?)"|\'([^\']+?)\'|([^\s"\'=<>`]+))', webpage, 'video_url')
2020-02-25 21:15:11 +00:00
ext = determine_ext(video_url)
2020-02-25 20:39:54 +00:00
return {
'id': video_id,
2020-02-25 21:15:11 +00:00
'display_id': display_id,
2020-02-25 20:39:54 +00:00
'title': title,
'url': video_url,
2020-02-25 21:15:11 +00:00
'ext': ext,
'thumbnail': thumbnail,
'description': description,
'uploader': uploader,
2020-02-25 20:39:54 +00:00
}