mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.3 KiB
Python
79 lines
2.3 KiB
Python
9 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
9 years ago
|
import re
|
||
9 years ago
|
|
||
|
from .common import InfoExtractor
|
||
7 years ago
|
from ..compat import (
|
||
|
compat_b64decode,
|
||
|
compat_urllib_parse_unquote,
|
||
|
)
|
||
9 years ago
|
|
||
|
|
||
|
class BigflixIE(InfoExtractor):
|
||
9 years ago
|
_VALID_URL = r'https?://(?:www\.)?bigflix\.com/.+/(?P<id>[0-9]+)'
|
||
|
_TESTS = [{
|
||
9 years ago
|
# 2 formats
|
||
9 years ago
|
'url': 'http://www.bigflix.com/Tamil-movies/Drama-movies/Madarasapatinam/16070',
|
||
|
'info_dict': {
|
||
|
'id': '16070',
|
||
|
'ext': 'mp4',
|
||
|
'title': 'Madarasapatinam',
|
||
8 years ago
|
'description': 'md5:9f0470b26a4ba8e824c823b5d95c2f6b',
|
||
9 years ago
|
'formats': 'mincount:2',
|
||
|
},
|
||
|
'params': {
|
||
|
'skip_download': True,
|
||
|
}
|
||
9 years ago
|
}, {
|
||
|
# multiple formats
|
||
|
'url': 'http://www.bigflix.com/Malayalam-movies/Drama-movies/Indian-Rupee/15967',
|
||
|
'only_matching': True,
|
||
9 years ago
|
}]
|
||
9 years ago
|
|
||
|
def _real_extract(self, url):
|
||
|
video_id = self._match_id(url)
|
||
|
|
||
|
webpage = self._download_webpage(url, video_id)
|
||
|
|
||
|
title = self._html_search_regex(
|
||
|
r'<div[^>]+class=["\']pagetitle["\'][^>]*>(.+?)</div>',
|
||
|
webpage, 'title')
|
||
|
|
||
9 years ago
|
def decode_url(quoted_b64_url):
|
||
7 years ago
|
return compat_b64decode(compat_urllib_parse_unquote(
|
||
|
quoted_b64_url)).decode('utf-8')
|
||
9 years ago
|
|
||
|
formats = []
|
||
|
for height, encoded_url in re.findall(
|
||
9 years ago
|
r'ContentURL_(\d{3,4})[pP][^=]+=([^&]+)', webpage):
|
||
9 years ago
|
video_url = decode_url(encoded_url)
|
||
|
f = {
|
||
|
'url': video_url,
|
||
|
'format_id': '%sp' % height,
|
||
|
'height': int(height),
|
||
|
}
|
||
|
if video_url.startswith('rtmp'):
|
||
|
f['ext'] = 'flv'
|
||
|
formats.append(f)
|
||
9 years ago
|
|
||
9 years ago
|
file_url = self._search_regex(
|
||
|
r'file=([^&]+)', webpage, 'video url', default=None)
|
||
|
if file_url:
|
||
|
video_url = decode_url(file_url)
|
||
|
if all(f['url'] != video_url for f in formats):
|
||
|
formats.append({
|
||
|
'url': decode_url(file_url),
|
||
|
})
|
||
9 years ago
|
|
||
9 years ago
|
self._sort_formats(formats)
|
||
9 years ago
|
|
||
|
description = self._html_search_meta('description', webpage)
|
||
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
|
'title': title,
|
||
|
'description': description,
|
||
9 years ago
|
'formats': formats
|
||
9 years ago
|
}
|