1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-30 16:52:57 +01:00

Merge branch 'miaopai' of https://github.com/xyb/youtube-dl into xyb-miaopai

This commit is contained in:
Yen Chi Hsuan 2016-09-08 00:08:02 +08:00
commit 2841bdcebb
No known key found for this signature in database
GPG Key ID: 3FDDD575826C5C30
2 changed files with 45 additions and 0 deletions

View File

@ -476,6 +476,7 @@ from .metacafe import MetacafeIE
from .metacritic import MetacriticIE
from .mgoon import MgoonIE
from .mgtv import MGTVIE
from .miaopai import MiaoPaiIE
from .microsoftvirtualacademy import (
MicrosoftVirtualAcademyIE,
MicrosoftVirtualAcademyCourseIE,

View File

@ -0,0 +1,44 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import sanitized_Request
class MiaoPaiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?miaopai\.com/show/(?P<id>[-A-Za-z0-9~_]+).htm'
_TEST = {
'url': 'http://www.miaopai.com/show/n~0hO7sfV1nBEw4Y29-Hqg__.htm',
'md5': '095ed3f1cd96b821add957bdc29f845b',
'info_dict': {
'id': 'n~0hO7sfV1nBEw4Y29-Hqg__',
'ext': 'mp4',
'title': '西游记音乐会的秒拍视频',
'thumbnail': 're:^https?://.*/n~0hO7sfV1nBEw4Y29-Hqg___m.jpg',
}
}
_USER_AGENT_IPAD = 'User-Agent:Mozilla/5.0 ' \
'(iPad; CPU OS 9_1 like Mac OS X) ' \
'AppleWebKit/601.1.46 (KHTML, like Gecko) ' \
'Version/9.0 Mobile/13B143 Safari/601.1'
def _real_extract(self, url):
video_id = self._match_id(url)
request = sanitized_Request(url)
request.add_header('User-Agent', self._USER_AGENT_IPAD)
webpage = self._download_webpage(request, video_id)
title = self._html_search_regex(r'<title>([^<]*)</title>',
webpage,
'title')
regex = r"""<div *class=['"]video_img[^>]*data-url=['"]([^'"]*\.jpg)['"]"""
thumbnail = self._html_search_regex(regex, webpage, '')
videos = self._parse_html5_media_entries(url, webpage, video_id)
info = videos[0]
info.update({'id': video_id,
'title': title,
'thumbnail': thumbnail,
})
return info