Exemplo n.º 1
0
    def __init__(self):
        from resources.lib.common.nethelper import net, cookies
        self.net, self.cookies = net, cookies

        self.html = ''
        self.html, e = self.net.get_html(helper.domain_url(), self.cookies,
                                         helper.domain_url())
Exemplo n.º 2
0
    def __login(self, username, password):
        #url = helper.domain_url() + '/user/ajax/login'
        form_data = {'username': username, 'password': password, 'remember': 1}

        ts = re.search('ts=\"(.*?)\"', self.html).group(1)
        url_base = re.search('href=\"(.*?)\"', self.html).group(1)

        params = [('username', str(username)), ('password', str(password)),
                  ('remember', '1'), ('ts', str(ts))]
        extra_para = self.__get_extra_url_parameter(params)  #1673
        url = '%s/user/ajax/login?ts=%s&_=%s' % (url_base, ts, extra_para)

        #helper.show_error_dialog(['',str(extra_para)])
        json = self.net.get_json(url, self.cookies, helper.domain_url(),
                                 form_data)
        helper.log_debug('login response: %s' % json)
        #helper.show_error_dialog(['',str(json)])

        if helper.handle_json_errors(json) or json.get('success',
                                                       False) == False:
            return False

        helper.set_setting('username', username)
        helper.set_setting('password', password)
        return True
Exemplo n.º 3
0
    def __init__(self):
        VideoPlayer.__init__(self)
        self.net, self.cookies = net, cookies
        self.url = '/watch/' + args.value.split('!!!!')[0]
        self.database = args.value.split('!!!!')[-1]

        self.html = ''
        self.html, e = self.net.get_html(helper.domain_url() + self.url,
                                         self.cookies, helper.domain_url())
        self.html = helper.handle_html_errors(self.html, e)

        self.soup = BeautifulSoup(self.html,
                                  "html.parser") if self.html != '' else None

        self.serverlist = {}
        self.serveridx = 0
        self.serverid = 28
    def __init__(self, url_val=args.value, form_data=None):
        self.html = ''
        self.soup = None
        self.links = []
        self.has_next_page = False

        self.meta = metadatahandler.meta
        self.net, self.cookies = nethelper.net, nethelper.cookies

        if not url_val:
            return

        self.url = url_val if 'http' in url_val else (helper.domain_url() +
                                                      url_val)
        self.html, e = self.net.get_html(self.url, self.cookies,
                                         helper.domain_url(), form_data)
        self.html = helper.handle_html_errors(self.html, e)
        helper.log_debug('HTML length: %s' % len(self.html))

        self.soup = BeautifulSoup(self.html,
                                  "html.parser") if self.html != '' else None
Exemplo n.º 5
0
    def __bookmark_operation(self, folder, add, list_str):
        str1 = 'add the show to' if add else 'remove the show from'
        str2 = 'added the show to' if add else 'removed the show from'

        ts = re.search('ts=\"(.*?)\"', self.html).group(1)
        url_base = re.search('href=\"(.*?)\"', self.html).group(1)

        params = [('folder', str(folder)), ('id', str(args.value)),
                  ('random', '1'), ('ts', str(ts))]
        extra_para = self.__get_extra_url_parameter(params)  #1673
        url = '%s/user/ajax/edit-watchlist?ts=%s&_=%s&folder=%s&id=%s&random=1' % (
            url_base, ts, extra_para, folder, args.value)

        json = self.net.get_json(url, self.cookies, helper.domain_url())
        #helper.show_error_dialog(['',str(json)])
        # returns status == False on failure
        if helper.handle_json_errors(json) or json.get('status',
                                                       False) == False:
            msg = 'Failed to %s the %s list' % (str1, list_str)
        else:
            msg = 'Successfully %s the %s list' % (str2, list_str)

        helper.show_small_popup(msg=msg)
        helper.refresh_page()
Exemplo n.º 6
0
    def __get_quality_links(self):
        # Grab the API token

        ep_id = self.serverlist.split('/')[-1]
        ts = re.search('ts=\"(.*?)\"', self.html).group(1)
        extra_para = self.__get_extra_url_parameter(ep_id, ts, self.serverid)

        #url = '%s/ajax/episode/info?id=%s&server=%s' % (helper.domain_url(), ep_id, serverid)
        url = '%s/ajax/episode/info?ts=%s&_=%s&id=%s&server=%s' % (
            helper.domain_url(), ts, extra_para, ep_id, self.serverid)

        params_url, e = self.net.get_html(url, self.cookies,
                                          helper.domain_url())
        #helper.show_error_dialog(['',str(ts)])
        ajax_json = {
            'params': {
                'id': '',
                'token': '',
                'options': ''
            },
            'type': 'iframe',
            'target': ''
        }

        rot8 = re.search('id\"\:\"(.*?)\"', params_url)  #.group(1)
        if rot8 != None: ajax_json['params']['id'] = rot8.group(1)

        rot8 = re.search('type\"\:\"(.*?)\"', params_url)
        if rot8 != None: ajax_json['type'] = rot8.group(1)

        rot8 = re.search('token\"\:\"(.*?)\"', params_url)
        if rot8 != None:
            ajax_json['params']['token'] = self.__cusb64_string(
                rot8.group(1)[1:])

        rot8 = re.search('options\"\:\"(.*?)\"', params_url)
        if rot8 != None:
            ajax_json['params']['options'] = self.__cusb64_string(
                rot8.group(1)[1:])

        rot8 = re.search('target\"\:\"(.*?)\"', params_url)
        if rot8 != None: ajax_json['target'] = rot8.group(1)

        #if helper.handle_json_errors(ajax_json):
        #    return []

        # Grab the links and their corresponding quality

        if (ajax_json['type'] == 'iframe'):
            target = ajax_json['target'].replace('\/', '/')
            if not 'http' in target:
                target = target.replace('//', 'https://')
            if 'rapidvideo' in target:
                params_url, e = self.net.get_html('%s&q=360p' % target,
                                                  self.cookies,
                                                  helper.domain_url())
                quali = re.findall(r'&q=(.*?)"', params_url)
                quali = quali[::-1]
                quali_choser = helper.present_selection_dialog(
                    'Choose the quality from the options below', quali)
                if (quali_choser != -1):
                    params_url, e = self.net.get_html(
                        '%s&q=' % target + quali[quali_choser], self.cookies,
                        helper.domain_url())
                    #helper.show_error_dialog(['',str(quali)])
                    target = re.search(
                        '<source\ssrc=\"([^\"]+)\"\s.+title=\"([^\"]+)\"\s.+?>',
                        params_url).group(1)
                    helper.resolve_url(target)
                target = ''
            if 'mcloud.to' in target:
                params_url, e = self.net.get_html(target, self.cookies,
                                                  helper.domain_url())
                m3u8_list = re.search('file":"(.*?)"', params_url).group(1)
                params_url, e = self.net.get_html(m3u8_list, self.cookies,
                                                  target)
                quali = re.findall(r'hls\/(.*?)\/', params_url)
                quali_choser = helper.present_selection_dialog(
                    'Choose the quality from the options below', quali)
                if (quali_choser != -1):
                    target_url = m3u8_list.replace(
                        'list.m3u8', 'hls/%s/%s.m3u8|Referer=%s' %
                        (quali[quali_choser], quali[quali_choser], target))
                    helper.resolve_url(target_url)
                target = ''

            self.link = target
            links = {}
            #helper.show_error_dialog(['',str(target)])
        else:
            vid_id = ajax_json['params']['id']
            token = ajax_json['params']['token']
            options = ajax_json['params']['options']

            grab_url = '%s/grabber-api/?id=%s&token=%s&options=%s' % (
                helper.domain_url(), vid_id, token, options)
            json = self.net.get_json(grab_url, self.cookies,
                                     helper.domain_url(), {})
            #helper.show_error_dialog(['',str(json)])
            if helper.handle_json_errors(json):
                return []

            links = json['data']
            links.reverse()
        return links