2018-02-23 20:01:20 +01:00
# coding: utf-8
from __future__ import unicode_literals
from . common import InfoExtractor
from . . utils import (
clean_html
)
2018-02-23 20:03:33 +01:00
2018-02-23 20:01:20 +01:00
class VidelloIE ( InfoExtractor ) :
2018-02-23 20:52:41 +01:00
_VALID_URL = r ' https?://(?:www \ .)?embed \ .vidello \ .com/[0-9]/(?P<id>[a-zA-Z0-9]+)/player.html '
2018-02-23 20:01:20 +01:00
_TEST = {
' url ' : ' https://embed.vidello.com/2/t1umm637xb1ylgw4/player.html ' ,
' md5 ' : ' 7a4d76ac74ef7724af4c6c3ecb5e0042 ' ,
' info_dict ' : {
' id ' : ' t1umm637xb1ylgw4 ' ,
' ext ' : ' mp4 ' ,
' title ' : ' Vidello Hosting & Marketing ' ,
' description ' : " Start marketing your videos more effectively on \x03 the web utilising vidello ' s premium hosting, streaming, \x03 analytics & marketing features to grow your \x03 online business fast. "
}
}
def _real_extract ( self , url ) :
video_id = self . _match_id ( url )
webpage = self . _download_webpage ( url , video_id )
vidello_settings = self . _parse_json ( self . _search_regex (
2018-02-23 20:55:06 +01:00
r ' settings \ s*= \ s*( { .+?}); ' , webpage , ' vidello settings ' ) , video_id )
2018-02-23 20:01:20 +01:00
2018-02-23 21:26:45 +01:00
video_url = ' '
2018-02-23 20:13:06 +01:00
video_sources = vidello_settings [ ' player ' ] [ ' clip ' ] [ ' sources ' ]
2018-02-23 20:01:20 +01:00
for curr_entry in video_sources :
2018-02-23 21:26:45 +01:00
if curr_entry [ ' type ' ] == ' video/mp4 ' :
video_url = ' http:// ' + curr_entry [ ' src ' ] [ 2 : ]
2018-02-23 20:11:21 +01:00
title = vidello_settings [ ' cta ' ] [ 0 ] [ ' values ' ] [ ' product_title ' ]
2018-02-23 20:01:20 +01:00
description = clean_html ( vidello_settings . get ( ' cta ' ) [ 0 ] . get ( ' values ' ) . get ( ' product_desc ' ) )
return {
' id ' : video_id ,
' title ' : title ,
' description ' : description ,
' url ' : video_url
}