Ejemplo n.º 1
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    if 'paris' in item_id:
        resp = urlquick.get(URL_ROOT + '/mediaplayer/live-bfm-paris/',
                            headers={'User-Agent': web_utils.get_random_ua()},
                            max_age=-1)
    else:
        resp = urlquick.get(URL_LIVE_BFM_REGION % item_id.replace('bfm', ''),
                            headers={'User-Agent': web_utils.get_random_ua()},
                            max_age=-1)

    root = resp.parse()
    live_datas = root.find(".//div[@class='video_block']")
    data_account = live_datas.get('accountid')
    data_video_id = live_datas.get('videoid')
    data_player = live_datas.get('playerid')
    return resolver_proxy.get_brightcove_video_json(plugin, data_account,
                                                    data_player, data_video_id)
def get_live_url(plugin, item_id, **kwargs):

    resp = urlquick.get(
        URL_ROOT, headers={"User-Agent": web_utils.get_random_ua()}, max_age=-1)
    live_id = re.compile("youtube.com/embed/(.*?)\"").findall(
        resp.text)[0]
    return resolver_proxy.get_stream_youtube(plugin,
                                             live_id,
                                             False)
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    video_id = re.compile(r'dailymotion.com/embed/video/(.*?)[\?\"]',
                          re.DOTALL).findall(resp.text)[0]
    return resolver_proxy.get_stream_dailymotion(plugin, video_id,
                                                 download_mode)
Ejemplo n.º 4
0
def get_live_url(plugin, item_id, **kwargs):

    # Get date of Today
    today = date.today()
    today_value = today.strftime("%Y%m%d")
    resp = urlquick.get(URL_LIVE_DATAS % today_value,
                        headers={"User-Agent": web_utils.get_random_ua()},
                        max_age=-1)
    json_parser = json.loads(resp.text)
    url_stream_datas = ''
    for stream_datas in json_parser:
        if 'EQUIDIA' in stream_datas['title']:
            url_stream_datas = stream_datas["streamUrl"]
    resp2 = urlquick.get(url_stream_datas,
                         headers={"User-Agent": web_utils.get_random_ua()},
                         max_age=-1)
    json_parser2 = json.loads(resp2.text)
    return json_parser2["primary"]
def get_live_url(plugin, item_id, **kwargs):
    """Get video URL and start video player"""

    resp = urlquick.get(URL_ROOT % item_id,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    live_id = re.compile(r'dailymotion.com/embed/video/(.*?)[\?\"]',
                         re.DOTALL).findall(resp.text)[0]
    return resolver_proxy.get_stream_dailymotion(plugin, live_id, False)
Ejemplo n.º 6
0
def get_video_url(plugin,
                  item_id,
                  program_id,
                  download_mode=False,
                  **kwargs):

    if 'www.wat.tv/embedframe' in program_id:
        url = 'http:' + program_id
    elif "http" not in program_id:
        if program_id[0] == '/':
            program_id = program_id[1:]
        url = URL_ROOT(program_id)
    else:
        url = program_id

    video_html = urlquick.get(url).text

    if 'www.wat.tv/embedframe' in program_id:
        video_id = re.compile('UVID=(.*?)&').findall(video_html)[0]
    elif item_id == 'lci':
        video_id = re.compile(r'data-videoid="(.*?)"').findall(video_html)[0]
    else:
        root = video_html.parse()
        iframe_player = root.find(".//div[@class='iframe_player']")
        if iframe_player is not None:
            video_id = iframe_player.get('data-watid')
        else:
            video_id = re.compile(
                r'www\.tf1\.fr\/embedplayer\/(.*?)\"').findall(video_html)[0]

    url_json = URL_VIDEO_STREAM % video_id
    htlm_json = urlquick.get(url_json,
                             headers={'User-Agent': web_utils.get_random_ua()},
                             max_age=-1)
    json_parser = json.loads(htlm_json.text)

    if download_mode:
        xbmcgui.Dialog().ok('Info', plugin.localize(30603))
        return False

    is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
    if not is_helper.check_inputstream():
        return False

    item = Listitem()
    item.path = json_parser["mpd"]
    item.label = get_selected_item_label()
    item.art.update(get_selected_item_art())
    item.info.update(get_selected_item_info())
    item.property[INPUTSTREAM_PROP] = 'inputstream.adaptive'
    item.property['inputstream.adaptive.manifest_type'] = 'mpd'
    item.property[
        'inputstream.adaptive.license_type'] = 'com.widevine.alpha'
    item.property[
        'inputstream.adaptive.license_key'] = URL_LICENCE_KEY % video_id

    return item
Ejemplo n.º 7
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    if item_id == 'bfmtv':
        resp = urlquick.get(URL_LIVE_BFMTV,
                            headers={'User-Agent': web_utils.get_random_ua()},
                            max_age=-1)
    elif item_id == 'bfmbusiness':
        resp = urlquick.get(URL_LIVE_BFMBUSINESS,
                            headers={'User-Agent': web_utils.get_random_ua()},
                            max_age=-1)

    root = resp.parse()
    live_datas = root.find(".//div[@class='next-player']")
    data_account = live_datas.get('data-account')
    data_video_id = live_datas.get('data-video-id')
    data_player = live_datas.get('data-player')
    return resolver_proxy.get_brightcove_video_json(plugin, data_account,
                                                    data_player, data_video_id)
Ejemplo n.º 8
0
def get_video_url(plugin, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    video_id = re.compile(r'www.youtube.com/embed/(.*?)[\?\"]').findall(
        resp.text)[0]

    return resolver_proxy.get_stream_youtube(plugin, video_id, download_mode)
def get_video_url(plugin,
                  item_id,
                  video_url,
                  content_id,
                  download_mode=False,
                  **kwargs):

    session = urlquick.Session()

    resp = session.get(video_url,
                       headers={'User-Agent': web_utils.get_random_ua()},
                       max_age=-1)
    video_id = re.compile(
        r'dataMediaId\"\:\"(.*?)\"').findall(resp.text)[0]

    resp2 = session.get(URL_STREAM_DATAS % video_id,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    json_parser2 = json.loads(resp2.text)

    url_stream = ''
    for stream_datas in json_parser2["dls"]:
        if 'hls' in stream_datas["format"]:
            url_stream = stream_datas["stream"]

    datas = {
        'oid': 'bitban_api',
        'eid': '/api/greenBox?contentId=%s&platform=mtweb' % content_id
    }
    resp3 = session.get(URL_MAB, params=datas)
    json_parser3 = json.loads(resp3.text)

    session.get(json_parser2["cerbero"] + '/geo', headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1)

    payload = {
        'bbx': json_parser2["bbx"],
        'gbx': json_parser3["gbx"]
    }
    resp4 = session.post(json_parser2["cerbero"],
                         json=payload,
                         headers={'User-Agent': web_utils.get_random_ua()},
                         max_age=-1)
    json_parser4 = json.loads(resp4.text)
    return url_stream + '?' + json_parser4["tokens"]["2"]["cdn"]
Ejemplo n.º 10
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    url_live = ''
    live_html = urlquick.get(URL_LIVE_TV,
                             headers={'User-Agent': web_utils.get_random_ua()},
                             max_age=-1)
    url_live_embeded = re.compile('<iframe src=\"(.*?)\"').findall(
        live_html.text)[0]
    root_live_embeded_html = urlquick.get(
        url_live_embeded,
        headers={'User-Agent': web_utils.get_random_ua()},
        max_age=-1)
    all_url_video = re.compile(r'file: \'(.*?)\'').findall(
        root_live_embeded_html.text)

    for url_video in all_url_video:
        if url_video.count('m3u8') > 0:
            url_live = url_video
    return url_live
Ejemplo n.º 11
0
def get_live_url(plugin, item_id, **kwargs):

    resp = urlquick.get(URL_LIVE, headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1)

    data_account_player = re.search('//players\.brightcove\.net/([0-9]+)/([A-Za-z0-9]+)_default/index\.html\?videoId=([0-9]+)', resp.text)
    data_account = data_account_player.group(1)
    data_player = data_account_player.group(2)
    data_video_id = data_account_player.group(3)

    return resolver_proxy.get_brightcove_video_json(plugin, data_account, data_player, data_video_id)
Ejemplo n.º 12
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    live_html = urlquick.get(URL_LIVE,
                             headers={'User-Agent': web_utils.get_random_ua()},
                             max_age=-1)
    list_url_stream = re.compile(r'file"\: "(.*?)"').findall(live_html.text)
    url_live = ''
    for url_stream_data in list_url_stream:
        if 'm3u8' in url_stream_data:
            url_live = url_stream_data
    return url_live
Ejemplo n.º 13
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    resp = urlquick.get(URL_LIVE,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    live_info_id = re.compile(r'dist\/js\/noovo\.(.*?)\.').findall(
        resp.text)[0]

    resp2 = urlquick.get(URL_LIVE_INFOS % live_info_id,
                         headers={'User-Agent': web_utils.get_random_ua()},
                         max_age=-1)

    data_account = re.compile(r'data-account\=\"(.*?)\"').findall(
        resp2.text)[0]
    data_player = re.compile(r'data-player\=\"(.*?)\"').findall(resp2.text)[0]
    data_video_id = re.compile(r'data-video-id\=\"(.*?)\"').findall(
        resp2.text)[0]
    return resolver_proxy.get_brightcove_video_json(plugin, data_account,
                                                    data_player, data_video_id,
                                                    False)
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    stream_url = re.compile('contentUrl\"\: \"(.*?)\"').findall(resp.text)[0]

    if download_mode:
        return download.download_video(stream_url)

    return stream_url
Ejemplo n.º 15
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    resp = urlquick.get(URL_ROOT,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    list_url_stream = re.compile(r'window.direct_video.src \= \'(.*?)\'').findall(resp.text)
    url_live = ''
    for url_stream_data in list_url_stream:
        if 'm3u8' in url_stream_data:
            url_live = url_stream_data
    return url_live
Ejemplo n.º 16
0
def get_live_url(plugin, item_id, video_id, item_dict, **kwargs):
    final_language = Script.setting['tvp3.language']

    # If we come from the M3U file and the language
    # is set in the M3U URL, then we overwrite
    # Catch Up TV & More language setting
    if type(item_dict) is not dict:
        item_dict = eval(item_dict)
    if 'language' in item_dict:
        final_language = item_dict['language']

    resp = urlquick.get(URL_LIVE,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    root = resp.parse()

    live_id = ''
    for live_datas in root.findall(".//div"):
        if live_datas.get('data-stationname') is not None:
            if item_id == 'tvpinfo':
                if 'info' in live_datas.find('.//img').get('alt'):
                    live_id = live_datas.get('data-video-id')
            elif item_id == 'tvppolonia':
                if 'Polonia' in live_datas.get('data-title'):
                    live_id = live_datas.get('data-video-id')
            elif item_id == 'tvppolandin':
                if 'News and entertainment' in live_datas.get('data-title'):
                    live_id = live_datas.get('data-video-id')
            elif item_id == 'tvp3':
                if LIVE_TVP3_REGIONS[utils.ensure_unicode(
                        final_language)] in live_datas.find('.//img').get(
                            'alt'):
                    live_id = live_datas.get('data-video-id')
    if live_id == '':
        # Add Notification
        return False
    lives_html = urlquick.get(
        URL_STREAM % live_id,
        headers={'User-Agent': web_utils.get_random_ua()},
        max_age=-1)
    return re.compile(r'src:\'(.*?)\'').findall(lives_html.text)[0]
Ejemplo n.º 17
0
def get_live_url(plugin, item_id, video_id, **kwargs):

    resp = urlquick.get(URL_ROOT,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    player_id = re.compile(r'\;player\=(.*?)\'').findall(resp.text)[0]
    session_urlquick = urlquick.Session(allow_redirects=False)
    resp2 = session_urlquick.get(
        URL_STREAM % player_id,
        headers={'User-Agent': web_utils.get_random_ua()},
        max_age=-1)
    location_url = resp2.headers['Location']
    resp3 = urlquick.get(location_url.replace(
        'infomaniak.com/', 'infomaniak.com/playerConfig.php'),
                         max_age=-1)
    json_parser = json.loads(resp3.text)
    stream_url = ''
    for stram_datas in json_parser['data']['integrations']:
        if 'hls' in stram_datas['type']:
            stream_url = stram_datas['url']
    return stream_url
def get_live_url(plugin, item_id, **kwargs):

    resp = urlquick.get(URL_LIVE,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    data_account = re.compile(r'data-account\'\,\'(.*?)\'').findall(
        resp.text)[0]
    data_player = re.compile(r'data-player\'\,\'(.*?)\'').findall(resp.text)[0]
    data_video_id = re.compile(r'data-video-id\'\,\'(.*?)\'').findall(
        resp.text)[0]
    return resolver_proxy.get_brightcove_video_json(plugin, data_account,
                                                    data_player, data_video_id)
Ejemplo n.º 19
0
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    root = urlquick.get(video_url,
                        headers={
                            'User-Agent': web_utils.get_random_ua()
                        },
                        max_age=-1).parse()
    video_id = root.find(".//div[@id='embed-main-video']").get('data-videoid')
    # video_id = re.compile(r'data-videoid\"\=\"(.*?)[\?\"]').findall(
    #     resp.text)[0]
    return resolver_proxy.get_stream_dailymotion(plugin, video_id,
                                                 download_mode)
Ejemplo n.º 20
0
def get_live_url(plugin, item_id, video_id, **kwargs):
    final_region = kwargs.get('language', Script.setting['la_1ere.language'])

    resp = urlquick.get(URL_LIVES_JSON,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    json_parser = json.loads(resp.text)

    region = utils.ensure_unicode(final_region)
    id_sivideo = json_parser[LIVE_LA1ERE_REGIONS[region]]["id_sivideo"]
    return resolver_proxy.get_francetv_live_stream(plugin,
                                                   id_sivideo.split('@')[0])
Ejemplo n.º 21
0
def get_live_url(plugin, item_id, **kwargs):

    resp2 = urlquick.get(
        URL_CLIENT_VALUE,
        headers={
            'User-Agent': web_utils.get_random_ua()
        })
    client_id_value = re.compile(
        r'clientKey\:\"(.*?)\"').findall(resp2.text)[0]

    final_region = kwargs.get('language', Script.setting['icitele.language'])
    region = utils.ensure_unicode(final_region)

    resp = urlquick.get(
        URL_LIVE % LIVE_ICI_TELE_REGIONS[region],
        headers={
            'User-Agent': web_utils.get_random_ua(),
            'Authorization': 'Client-Key %s' % client_id_value
        })
    json_parser = json.loads(resp.text)
    return json_parser["url"]
Ejemplo n.º 22
0
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    video_json = re.compile('data-broadcast=\'(.*?)\'').findall(resp.text)[0]
    json_parser = json.loads(video_json)
    final_video_url = json_parser["files"][0]["url"]

    if download_mode:
        return download.download_video(final_video_url)
    return final_video_url
Ejemplo n.º 23
0
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    data_account = re.compile(r'data-account\=\"(.*?)\"').findall(resp.text)[0]
    data_player = re.compile(r'data-player\=\"(.*?)\"').findall(resp.text)[0]
    data_video_id = re.compile(r'data-video-id\=\"(.*?)\"').findall(
        resp.text)[0]
    return resolver_proxy.get_brightcove_video_json(plugin, data_account,
                                                    data_player, data_video_id,
                                                    download_mode)
def get_live_url(plugin, item_id, **kwargs):

    live_id = ''
    for channel_name, live_id_value in list(LIST_LIVE_TV5MONDE.items()):
        if item_id == channel_name:
            live_id = live_id_value
    resp = urlquick.get(URL_TV5MONDE_LIVE + '%s.html' % live_id,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    live_json = re.compile(r'data-broadcast=\'(.*?)\'').findall(resp.text)[0]
    json_parser = json.loads(live_json)
    return json_parser["files"][0]["url"]
Ejemplo n.º 25
0
def get_video_url(plugin,
                  item_id,
                  video_url,
                  download_mode=False,
                  video_label=None,
                  **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    video_id = re.compile(r'video: "(.*?)"').findall(resp.text)[0]
    return resolver_proxy.get_stream_dailymotion(plugin, video_id,
                                                 download_mode, video_label)
Ejemplo n.º 26
0
def list_videos(plugin, program_slug, video_type_value, offset, **kwargs):
    plugin.add_sort_methods(xbmcplugin.SORT_METHOD_UNSORTED)
    params = {
        'id': '6708f510f2af7e75114ab3c4378142b2ce25cd636ff5a1ae11f47ce7ad9c4a91',
        'variables': '{"programSlug":"%s","offset":%d,"limit":20,"sort":{"type":"DATE","order":"DESC"},"types":["%s"]}' % (program_slug, int(offset), video_type_value)
    }
    headers = {
        'content-type': 'application/json',
        'referer': 'https://www.tf1.fr/programmes-tv',
        'User-Agent': web_utils.get_random_ua()
    }
    resp = urlquick.get(URL_API, params=params, headers=headers)
    json_parser = json.loads(resp.text)
Ejemplo n.º 27
0
def get_video_url(plugin, video_id, download_mode=False, **kwargs):

    video_format = 'dash'
    url_json = URL_VIDEO_STREAM % (video_id, video_format)
    htlm_json = urlquick.get(url_json,
                             headers={'User-Agent': web_utils.get_random_ua()},
                             max_age=-1)
    json_parser = json.loads(htlm_json.text)

    if json_parser['code'] >= 400:
        plugin.notify('ERROR', plugin.localize(30716))
        return False

    if download_mode:
        xbmcgui.Dialog().ok('Info', plugin.localize(30603))
        return False

    url_json = URL_VIDEO_STREAM % (video_id, video_format)
    htlm_json = urlquick.get(url_json,
                             headers={'User-Agent': web_utils.get_random_ua()},
                             max_age=-1)
    json_parser = json.loads(htlm_json.text)

    is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
    if not is_helper.check_inputstream():
        return False

    item = Listitem()
    item.path = json_parser["url"]
    item.label = get_selected_item_label()
    item.art.update(get_selected_item_art())
    item.info.update(get_selected_item_info())
    item.property[INPUTSTREAM_PROP] = 'inputstream.adaptive'
    item.property['inputstream.adaptive.manifest_type'] = 'mpd'
    item.property['inputstream.adaptive.license_type'] = 'com.widevine.alpha'
    item.property[
        'inputstream.adaptive.license_key'] = URL_LICENCE_KEY % video_id

    return item
Ejemplo n.º 28
0
def list_videos(plugin, item_id, program_title, **kwargs):

    headers = {
        'X-MINISITE-DOMAIN':
<<<<<<< HEAD:plugin.video.catchuptvandmore/resources/lib/channels/fr/jack.py
        'jack.mycanal.fr',
=======
        'jack.canalplus.com',
>>>>>>> cf69920d1ba10a4558544c5d79d7c35f56d3e2c3:resources/lib/channels/fr/jack.py
        'User-Agent':
        web_utils.get_random_ua()
    }
    resp = urlquick.get(URL_VIDEOS, headers=headers)
    print(repr(resp.text))
    json_parser = json.loads(resp.text)

    for program_datas in json_parser["blocks"]:
        if program_datas["container"] == 'content':
            if 'template' in program_datas["content"]:
                if program_title == program_datas["content"]["title"]:

                    for video_datas in program_datas["content"]["articles"]:
                        if 'video' in video_datas:
                            video_title = video_datas["title"]
                            video_image = ''
                            if 'links' in video_datas["mainMedia"]["default"]:
                                video_image = video_datas["mainMedia"][
                                    "default"]["links"][0]["href"]
                                video_image = video_image.replace(
                                    '{width}', '800').replace(
                                        '{height}', '450')
                            video_plot = video_datas["abstract"]
                            video_id = video_datas["video"]["id"]
                            video_source = video_datas["video"]["source"]
                            date_value = video_datas["publishedAt"].split('T')[
                                0]

                            item = Listitem()
                            item.label = video_title
                            item.art['thumb'] = item.art['landscape'] = video_image
                            item.info['plot'] = video_plot
                            item.info.date(date_value, '%Y-%m-%d')

                            item.set_callback(
                                get_video_url,
                                item_id=item_id,
                                video_id=video_id,
                                video_source=video_source)
                            item_post_treatment(
                                item, is_playable=True, is_downloadable=True)
                            yield item
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):

    resp = urlquick.get(video_url,
                        headers={'User-Agent': web_utils.get_random_ua()},
                        max_age=-1)
    root = resp.parse()
    stream_url = root.find(".//iframe[@id='main_video']").get('src')
    if 'player.vimeo.com' in stream_url:
        video_id = re.compile(r'player.vimeo.com\/video/(.*?)\?').findall(
            stream_url)[0]
        return resolver_proxy.get_stream_vimeo(plugin, video_id, download_mode)
    else:
        # TODO if new video hoster
        return False
def get_live_url(plugin, item_id, **kwargs):

    if item_id in ('spectacles-et-culture', 'france-2', 'france-3', 'france-4',
                   'france-5'):
        resp = urlquick.get(URL_LIVE % item_id,
                            headers={'User-Agent': web_utils.get_random_ua()},
                            max_age=-1)
        broadcast_id = re.compile(r'videoId\"\:\"(.*?)\"',
                                  re.DOTALL).findall(resp.text)[0]
        return resolver_proxy.get_francetv_live_stream(plugin, broadcast_id)

    broadcast_id = 'SIM_France%s'
    return resolver_proxy.get_francetv_live_stream(
        plugin, broadcast_id % item_id.split('-')[1])