示例#1
0
def search_results(search_string):
    post_data = '{"paths":[["search","%s",{"from":0,"to":48},["summary","title"]],["search","%s",["id","length",' \
                '"name","trackIds","requestId"]]],"authURL":"%s"}' % (search_string, search_string,
                                                                      generic_utility.get_setting('authorization_url'))
    content = connect.load_netflix_site(generic_utility.evaluator(),
                                        post=post_data)
    return content
示例#2
0
def add_or_remove(video_id, is_add):

    content = connect.load_netflix_site("https://www.netflix.com/")
    falkor_cache = generic_utility.parse_falkorcache(content)

    root_list, my_list = generic_utility.extract_mylist_id(falkor_cache)
    auth = generic_utility.get_setting('authorization_url')

    track_id = get_track_id(my_list)

    if is_add:
        add_or_remove_str = 'addToList'
        add_or_remove_msg = 'added'
    else:
        add_or_remove_str = 'removeFromList'
        add_or_remove_msg = 'removed'

    post = ('{"callPath":["lolomos","%s","%s"],"params":["%s",2,["videos",%s],%s,null,null],'+\
           '"authURL":"%s"}') % (root_list, add_or_remove_str, my_list, video_id, track_id, auth)

    content = connect.load_netflix_site(generic_utility.evaluator()+'&method=call', post, options=True)

    if '"invalidated"' in content:
        generic_utility.notification('Successfully '+add_or_remove_msg)
    elif 'already exists' in content:
        generic_utility.notification('already exists')

    generic_utility.debug('add to mylist content: '+content)
示例#3
0
def videos_matches(video_type, page, url):
    post_data = ''
    if not xbmcvfs.exists(generic_utility.cookies_file()):
        login.login()

    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2

    if 'genre' in url:
        post_data = generic_utility.genre % (
            url.split('?')[1], off_from, off_to,
            generic_utility.get_setting('authorization_url'))
    elif 'list?' in url:
        data = url.split('?')[1]
        if ('mylist' in data):
            list_id = data.split('&')[0]
        else:
            list_id = data
        post_data = generic_utility.list_paths % (
            list_id, off_from, off_to,
            generic_utility.get_setting('authorization_url'))

    target_url = generic_utility.evaluator()
    response = connect.load_netflix_site(target_url, post=post_data)
    #    utility.log('response: '+response)
    video_ids = extract_other_video_ids(response, video_type)
    return video_ids
示例#4
0
def add_or_remove(video_id, is_add):
    root_list = get_root_list()

    my_list = get_mylist(root_list)[0]
    auth = generic_utility.get_setting('authorization_url')
    track_id = get.track_id_list(my_list)

    if is_add:
        add_or_remove_str = 'addToList'
        add_or_remove_msg = 'added'
    else:
        add_or_remove_str = 'removeFromList'
        add_or_remove_msg = 'removed'

    post = ('{"callPath":["lolomos","%s","%s"],"params":["%s",2,["videos",%s],%s,null,null],' +
            '"authURL":"%s"}') % (root_list, add_or_remove_str, my_list, video_id, track_id, auth)

    content = connect.load_netflix_site(generic_utility.evaluator()+'&method=call', post, options=True)

    jsn = json.loads(content)

    generic_utility.log('mylist: '+my_list)
    generic_utility.log(str(jsn))
    if '"invalidated"' in content:
        generic_utility.notification('Successfully '+add_or_remove_msg)
    elif 'already exists' in content:
        generic_utility.notification('already exists')

    generic_utility.debug('add to mylist content: '+content)
示例#5
0
def video_playback_info(video_ids):
    ids_str = ''
    for video_id in video_ids:
        ids_str+='"'+video_id+'",'
    ids_str = ids_str[:-1]
    post_data = generic_utility.video_playback_info % (ids_str, generic_utility.get_setting('authorization_url'))
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
    return content
示例#6
0
def genre_info(video_type):
    post_data = ''
    if video_type == 'tv':
        post_data = generic_utility.series_genre % generic_utility.get_setting('authorization_url')
    elif video_type == 'movie':
        post_data = generic_utility.movie_genre % generic_utility.get_setting('authorization_url')
    else:
        pass
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
    return content
示例#7
0
def genre_info(video_type):
    post_data = ''
    if video_type == 'show':
        post_data = generic_utility.series_genre % generic_utility.get_setting('authorization_url')
    elif video_type == 'movie':
        post_data = generic_utility.movie_genre % generic_utility.get_setting('authorization_url')
    else:
        pass
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data, headers={"Content-Type":"application/json"})
    return content
def add(video_id):
    post_data = generic_utility.my_list % generic_utility.get_setting('authorization_url')
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
    match = json.loads(content)['value']['videos']
    headers = {'Access-Control-Request-Headers': 'content-type, accept','Access-Control-Request-Method': 'POST',
               'Origin': 'http://www.netflix.com'}
    connect.load_netflix_site(generic_utility.evaluator() + '&method=call', options=True, headers=headers)
    cookies = {'lhpuuidh-browse-' + generic_utility.get_setting('selected_profile'): urllib.quote_plus(
        generic_utility.get_setting('language').split('-')[1] + ':' + generic_utility.get_setting('language').upper() + ':' + generic_utility.get_setting('root_list')), 'SecureNetflixId': 'v%3D2%26mac%3DAQEAEQABABRkPnYy2LvtMo02JH3beZhI4vKJAM2mLeM.%26dt%3D1449696369549'}
    post_data = generic_utility.add_list % (generic_utility.get_setting('root_list'),
                                            generic_utility.get_setting('my_list'),
                                            video_id,
                                            generic_utility.get_setting('track_id'),
                                            unicode(len(match)),
                                            generic_utility.get_setting('authorization_url'))
    headers = {'Referer': 'http://www.netflix.com/browse',
               'Origin': 'http://www.netflix.com'}
    content = connect.load_netflix_site(generic_utility.evaluator() + '&method=call',
                                        cookies=cookies,
                                        headers=headers,
                                        post=post_data)
def add(video_id):
    post_data = generic_utility.my_list % generic_utility.get_setting(
        'authorization_url')
    content = connect.load_netflix_site(generic_utility.evaluator(),
                                        post=post_data)
    match = json.loads(content)['value']['videos']
    headers = {
        'Access-Control-Request-Headers': 'content-type, accept',
        'Access-Control-Request-Method': 'POST',
        'Origin': 'http://www.netflix.com'
    }
    connect.load_netflix_site(generic_utility.evaluator() + '&method=call',
                              options=True,
                              headers=headers)
    cookies = {
        'lhpuuidh-browse-' + generic_utility.get_setting('selected_profile'):
        urllib.quote_plus(
            generic_utility.get_setting('language').split('-')[1] + ':' +
            generic_utility.get_setting('language').upper() + ':' +
            generic_utility.get_setting('root_list')),
        'SecureNetflixId':
        'v%3D2%26mac%3DAQEAEQABABRkPnYy2LvtMo02JH3beZhI4vKJAM2mLeM.%26dt%3D1449696369549'
    }
    post_data = generic_utility.add_list % (
        generic_utility.get_setting('root_list'),
        generic_utility.get_setting('my_list'), video_id,
        generic_utility.get_setting('track_id'), unicode(
            len(match)), generic_utility.get_setting('authorization_url'))
    headers = {
        'Referer': 'http://www.netflix.com/browse',
        'Origin': 'http://www.netflix.com'
    }
    content = connect.load_netflix_site(generic_utility.evaluator() +
                                        '&method=call',
                                        cookies=cookies,
                                        headers=headers,
                                        post=post_data)
示例#10
0
def video_info(video_id, lock = None, ignore_cache = False):
    content = ''
    cache_file = xbmc.translatePath(generic_utility.cache_dir() + video_id + '.cache')
    if not ignore_cache and xbmcvfs.exists(cache_file):
        file_handler = xbmcvfs.File(cache_file, 'rb')
        content = generic_utility.decode(file_handler.read())
        file_handler.close()
    if not content:
        post_data = generic_utility.video_info % (video_id, video_id, video_id, video_id,
                                                  generic_utility.get_setting('authorization_url'))
        content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data, lock = lock)
        file_handler = xbmcvfs.File(cache_file, 'wb')
        file_handler.write(generic_utility.encode(content))
        file_handler.close()
    return content
示例#11
0
def load_site_internal(url, session, post=None, options=False, headers=None, cookies=None, netflix=False):
    session.max_redirects = 10

    if options:
        response = session.options(url, headers=headers, cookies=cookies, verify=False)
        if response.status_code != 200:
            generic_utility.error('error options! url: '+url)
            response.raise_for_status()
    if post:
        if url == generic_utility.evaluator():
            session.cookies['profilesNewSession']='0'
            response = session.post(url, json = post)
        else:
            response = session.post(url, headers=headers, cookies=cookies, data=post, verify=False)
    else:
        response = session.get(url, headers=headers, cookies=cookies, verify=False)

    content = response.content
    status = response.status_code
    return content, status
示例#12
0
def videos_matches(video_type, page, url):
    post_data = ''

    items_per_page = int(generic_utility.get_setting('items_per_page'))
    off_from = page * items_per_page
    off_to = off_from + items_per_page - 2

    if 'genre' in url:
        post_data = generic_utility.genre % (url.split('?')[1], off_from, off_to, generic_utility.get_setting('authorization_url'))
    elif 'list?' in url:
        data = url.split('?')[1]
        if('mylist' in data):
            list_id = data.split('&')[0]
        else:
            list_id = data
        post_data = generic_utility.list_paths % (list_id, off_from, off_to, generic_utility.get_setting('authorization_url'))

    target_url = generic_utility.evaluator()
    response = connect.load_netflix_site(target_url, post=post_data)
#    utility.log('response: '+response)
    video_ids = extract_other_video_ids(response, video_type)
    return video_ids
示例#13
0
def track_id_list(list):
    post_data = '{"paths":[["lists","%s","trackIds"]],"authURL":"%s"}' % (list, generic_utility.get_setting('authorization_url'))
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
    return content
示例#14
0
def search_results(search_string):
    post_data = '{"paths":[["search","%s",{"from":0,"to":48},["summary","title"]],["search","%s",["id","length",' \
                '"name","trackIds","requestId"]]],"authURL":"%s"}' % (search_string, search_string,
                                                                      generic_utility.get_setting('authorization_url'))
    content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
    return content