[eslkidslab] add support: eslkidslab.com

This commit is contained in:
ox0spy 2018-08-13 10:29:11 +08:00
parent bda3b940f4
commit eca2218376
4 changed files with 47 additions and 1 deletions

View File

@ -417,6 +417,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
| 快手 | <https://www.kuaishou.com/> |✓|✓| |
| 抖音 | <https://www.douyin.com/> |✓| | |
| 中国体育(TV) | <http://v.zhibo.tv/> </br><http://video.zhibo.tv/> |✓| | |
| eslkidslab | <http://www.eslkidslab.com/> |✓| | |
For all other sites not on the list, the universal extractor will take care of finding and downloading interesting resources from the page.

View File

@ -127,6 +127,7 @@ SITES = {
'youtube' : 'youtube',
'zhanqi' : 'zhanqi',
'zhibo' : 'zhibo',
'eslkidslab' : 'eslkidslab',
}
dry_run = False

View File

@ -89,3 +89,4 @@ from .khan import *
from .zhanqi import *
from .kuaishou import *
from .zhibo import *
from .eslkidslab import *

View File

@ -0,0 +1,43 @@
from ..common import (
get_content, re, download_urls, playlist_not_supported, print_info,
url_info, parse, log
)
def get_play_source(url):
source, play_source = None, None
base_url = '/'.join(url.split('/')[:-1])
html = get_content(url)
if '_playListXML_Path' in html:
play_path = re.search('_playListXML_Path=([^<>;"]+)', html).group(1)
play_path_url = '{}/{}'.format(base_url, play_path)
data = get_content(play_path_url)
source = re.search('<source>(.+?)</source>', data).group(1)
elif 'videoUrl' in html:
source = re.search('videoUrl=([^&<>"]+)', html).group(1)
if source:
source = parse.quote(source)
play_source = '{}/{}'.format(base_url, source)
return play_source
def eslkidslab_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
url = parse.quote(url, safe=':/%')
play_source = get_play_source(url)
if not play_source:
log.w('can not get video file, skip ...')
return
title = play_source.split('/')[-1].split('.')[0]
title = parse.unquote(title)
_, ext, size = url_info(play_source)
print_info(site_info, title, ext, size)
if not info_only:
download_urls([play_source], title, ext, size, output_dir, merge=merge)
site_info = 'eslkidslab.com'
download = eslkidslab_download
download_playlist = playlist_not_supported('eslkidslab')