1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-02 18:53:21 +08:00

[yizhibo] Add new extractor

This commit is contained in:
qsniyg 2018-11-14 20:24:57 -08:00
parent 730c0d12a0
commit 54fd7ac5c8
2 changed files with 44 additions and 1 deletions

View File

@ -1371,7 +1371,7 @@ from .webofstories import (
WebOfStoriesPlaylistIE,
)
from .weibo import (
WeiboIE,
WeiboIE,
WeiboMobileIE
)
from .weiqitv import WeiqiTVIE
@ -1423,6 +1423,7 @@ from .yandexdisk import YandexDiskIE
from .yapfiles import YapFilesIE
from .yesjapan import YesJapanIE
from .yinyuetai import YinYueTaiIE
from .yizhibo import YizhiboIE
from .ynet import YnetIE
from .youjizz import YouJizzIE
from .youku import (

View File

@ -0,0 +1,42 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
js_to_json,
)
class YizhiboIE(InfoExtractor):
_VALID_URL = r'https?://(?:wb\.)?yizhibo\.com/l/(?P<id>[^/?#&.]+)\.html(?:[?#].*)?'
_TEST = {
'url': 'https://wb.yizhibo.com/l/QcnhER5fkh_drtI3.html',
'md5': '4a61687d770de05fd2b67bd7f1b52bc3',
'info_dict': {
'id': 'QcnhER5fkh_drtI3',
'ext': 'm3u8',
'title': 'hyominnn00-一直播'
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._search_regex(r'<title>(.*?)</title>', webpage, 'video title')
json_raw = self._search_regex(r'window\.anchor *= *({[\s\S]*?});', webpage, 'video data')
json = self._parse_json(json_raw, video_id, transform_source=js_to_json)
play_url = json['play_url']
formats = self._extract_m3u8_formats(play_url, video_id)
return {
'id': video_id,
'url': url,
'title': title,
'formats': formats,
}