Exemple #1
0
def get_tenies_online_links(url):
    urls = []

    headers = {'User-Agent': client.randomagent(), 'Referer': url}
    r = client.request(url)
    try:
        frames = client.parseDOM(r, 'div', {'id': 'playeroptions'})[0]
        frames = dom.parse_dom(frames,
                               'li',
                               attrs={'class': 'dooplay_player_option'},
                               req=['data-post', 'data-nume', 'data-type'])
        for frame in frames:
            post = 'action=doo_player_ajax&post=%s&nume=%s&type=%s' % \
                   (frame.attrs['data-post'], frame.attrs['data-nume'], frame.attrs['data-type'])
            if '=trailer' in post: continue
            p_link = 'https://tenies-online.gr/wp-admin/admin-ajax.php'

            flink = client.request(p_link, post=post, headers=headers)
            flink = client.parseDOM(flink, 'iframe', ret='src')[0]

            host = __top_domain(flink)
            urls.append((flink, host))
        xbmc.log('FRAMES-LINKs: %s' % urls)
    except BaseException:
        pass

    try:
        extra = client.parseDOM(r, 'div', attrs={'class': 'links_table'})[0]
        extra = dom.parse_dom(extra, 'td')
        extra = [
            dom.parse_dom(i.content, 'img', req='src') for i in extra if i
        ]
        extra = [(i[0].attrs['src'],
                  dom.parse_dom(i[0].content, 'a', req='href')) for i in extra
                 if i]
        extra = [(re.findall('domain=(.+?)$', i[0])[0], i[1][0].attrs['href'])
                 for i in extra if i]
        for item in extra:
            url = item[1]
            if 'paidikestainies' in url:
                continue
            if 'tenies-online' in url:
                url = client.request(url, output='geturl', redirect=True)
            else:
                url = url

            host = item[0]

            urls.append((url, host))
        xbmc.log('EXTRA-LINKs: %s' % urls)
    except BaseException:
        pass

    return urls
Exemple #2
0
def get_links(name, url, iconimage, description):
    # try:
        headers = {'Referer': url}
        data = client.request(url)
        try:
            back = client.parseDOM(data, 'div', {'id': 'dt_galery'})[0]#dt_galery
            back = client.parseDOM(back, 'a', ret='href')[0]
        except IndexError:
            back = FANART
        try:
            frames = client.parseDOM(data, 'div', {'id': 'playeroptions'})[0]
            frames = dom.parse_dom(frames, 'li', attrs={'class': 'dooplay_player_option'},
                               req=['data-post', 'data-nume', 'data-type'])
            for frame in frames:
                post = 'action=doo_player_ajax&post=%s&nume=%s&type=%s' % \
                       (frame.attrs['data-post'], frame.attrs['data-nume'], frame.attrs['data-type'])
                p_link = 'https://metaglotismeno.online/wp-admin/admin-ajax.php'

                flink = client.request(p_link, post=post, headers=headers)
                flink = client.parseDOM(flink, 'iframe', ret='src')[0]

                if '=trailer' in post and 'youtu' in flink:
                    addDir('[B][COLOR white]%s | [B][COLOR lime]Trailer[/COLOR][/B]' % name, flink, 100, iconimage,
                           FANART, '')

                else:
                    host = __top_domain(flink)
                    title = '{0} [B][COLOR white]| {1}[/COLOR][/B]'.format(name, host.capitalize())
                    addDir(title, flink, 100, iconimage, back, str(description))
        except BaseException:
            title = '[B][COLOR white]NO LINKS[/COLOR][/B]'
            addDir(title, '', 'bug', iconimage, back, str(description))
    # except BaseException:
    #     pass
        views.selectView('movies', 'movie-view')
def metaglotismeno(url):  #34
    data = client.request(url)
    posts = client.parseDOM(data, 'div', attrs={'class': 'items'})[0]
    posts = client.parseDOM(posts, 'article', attrs={'id': r'post-\d+'})
    for post in posts:
        try:
            plot = client.parseDOM(post, 'div', attrs={'class': 'texto'})[0]
        except IndexError:
            plot = 'N/A'
        desc = client.replaceHTMLCodes(plot)
        desc = desc.encode('utf-8')
        try:
            title = client.parseDOM(post, 'h3')[0]
        except BaseException:
            title = client.parseDOM(post, 'img', ret='alt')[0]
        # try:
        #     year = client.parseDOM(data, 'div', {'class': 'metadata'})[0]
        #     year = client.parseDOM(year, 'span')[0]
        #     year = '[COLOR lime]({0})[/COLOR]'.format(year)
        # except IndexError:
        #     year = '(N/A)'
        title = clear_Title(title)
        title = '[B][COLOR white]{}[/COLOR][/B]'.format(title)
        link = client.parseDOM(post, 'a', ret='href')[0]
        link = client.replaceHTMLCodes(link).encode('utf-8', 'ignore')
        poster = client.parseDOM(post, 'img', ret='src')[0]
        poster = client.replaceHTMLCodes(poster).encode('utf-8', 'ignore')

        addDir(title, link, 33, poster, FANART, desc)
    try:
        np = client.parseDOM(data, 'div', attrs={'class': 'resppages'})[0]
        np = dom.parse_dom(np, 'a', req='href')
        np = [
            i.attrs['href'] for i in np if 'icon-chevron-right' in i.content
        ][0]
        page = re.findall(r'page/(\d+)/', np)[0]
        title = '[B][COLORgold]>>>' + Lang(32011).encode('utf-8') +\
                ' [COLORwhite]([COLORlime]{}[/COLOR])[/COLOR][/B]'.format(page)
        addDir(title, np.encode('utf-8'), 34, ART + 'next.jpg', FANART, '')
    except BaseException:
        pass
    views.selectView('movies', 'movie-view')
def get_links(name, url, iconimage, description):
    data = requests.get(url).text
    try:
        if 'Trailer' in data:
            flink = client.parseDOM(data,
                                    'iframe',
                                    ret='src',
                                    attrs={'class': 'rptss'})[0]
            if 'youtu' in flink:
                addDir('[B][COLOR lime]Trailer[/COLOR][/B]', flink, 100,
                       iconimage, FANART, '')
        else:
            addDir('[B][COLOR lime]No Trailer[/COLOR][/B]', '', 100, iconimage,
                   FANART, '')
    except BaseException:
        pass
    # try:
    if 'tvshows' not in url:
        try:
            frame = client.parseDOM(data,
                                    'iframe',
                                    ret='src',
                                    attrs={'class': 'metaframe rptss'})[0]
            html = requests.get(frame).text
            post_url = 'https://coverapi.store/engine/ajax/controller.php'
            postdata = re.findall(
                r'''data: \{mod: 'players', news_id: '(\d+)'\},''', html,
                re.DOTALL)[0]
            # xbmc.log('POSR-DATA: {}'.format(str(postdata)))
            postdata = {'mod': 'players', 'news_id': postdata}
            hdrs = {
                'Origin': 'https://coverapi.store',
                'Referer': frame,
                'User-Agent': client.agent()
            }
            post_html = requests.post(post_url, data=postdata,
                                      headers=hdrs).text.replace('\\', '')
            # xbmc.log('POSR-HTML: {}'.format(str(post_html)))
            frame = re.findall(r'''file:\s*['"](http.+?)['"]''', post_html,
                               re.DOTALL)[0]
            title = '{} | [B]{}[/B]'.format(name, 'Gamato')
            addDir(title, frame, 100, iconimage, FANART, str(description))
        except IndexError:
            pass
        try:
            frames = client.parseDOM(data, 'tr', {'id': r'link-\d+'})
            frames = [(client.parseDOM(i,
                                       'a',
                                       ret='href',
                                       attrs={'target': '_blank'})[0],
                       client.parseDOM(i, 'img', ret='src')[0],
                       client.parseDOM(i, 'strong', {'class': 'quality'})[0])
                      for i in frames if frames]
            for frame, domain, quality in frames:
                host = domain.split('=')[-1]
                host = six.ensure_str(host, 'utf-8')
                # if 'Μεταγλωτισμένο' in info.encode('utf-8', 'ignore'):
                #     info = '[Μετ]'
                # elif 'Ελληνικοί' in info.encode('utf-8', 'ignore'):
                #     info = '[Υπο]'
                # elif 'Χωρίς' in info.encode('utf-8', 'ignore'):
                #     info = '[Χωρίς Υπ]'
                # else:
                #     info = '[N/A]'
                quality = 'SD'
                title = '{} | [B]{}[/B] | ({})'.format(name, host.capitalize(),
                                                       quality)
                addDir(title, frame, 100, iconimage, FANART, str(description))
        except BaseException:
            pass
    else:
        data = client.parseDOM(data,
                               'table',
                               attrs={'class': 'easySpoilerTable'})
        seasons = [
            dom.parse_dom(i, 'a', {'target': '_blank'}, req='href')
            for i in data[:-1] if i
        ]
        episodes = []
        for season in seasons:
            for epi in season:
                title = clear_Title(epi.content.replace('×', 'x'))
                frame = epi.attrs['href']
                episodes.append((title, frame))

        for title, frame in episodes:
            addDir(title, frame, 100, iconimage, FANART, str(description))

    # except BaseException:
    #     title = '[B][COLOR white]NO LINKS[/COLOR][/B]'
    #     addDir(title, '', 'bug', iconimage, FANART, str(description))
    views.selectView('movies', 'movie-view')
def get_links(name, url, iconimage, description):
    data = client.request(url)
    try:
        if 'Τρέιλερ' in data:
            flink = client.parseDOM(data,
                                    'iframe',
                                    ret='src',
                                    attrs={'class': 'rptss'})[0]
            if 'youtu' in flink:
                addDir('[B][COLOR lime]Trailer[/COLOR][/B]', flink, 100,
                       iconimage, FANART, '')
        else:
            addDir('[B][COLOR lime]No Trailer[/COLOR][/B]', '', 100, iconimage,
                   FANART, '')
    except BaseException:
        pass
    try:
        if 'tvshows' not in url:
            frames = client.parseDOM(data, 'tr', {'id': r'link-\d+'})
            frames = [(client.parseDOM(i,
                                       'a',
                                       ret='href',
                                       attrs={'target': '_blank'})[0],
                       client.parseDOM(i, 'img', ret='src')[0],
                       client.parseDOM(i, 'strong', {'class': 'quality'})[0],
                       client.parseDOM(i, 'td')[-3]) for i in frames if frames]
            for frame, domain, quality, info in frames:
                xbmc.log('INFO: {}'.format(str(info.encode('utf-8',
                                                           'ignore'))))
                host = domain.split('=')[-1].encode('utf-8')
                if 'Μεταγλωτισμένο' in info.encode('utf-8', 'ignore'):
                    info = '[Μετ]'
                elif 'Ελληνικοί' in info.encode('utf-8', 'ignore'):
                    info = '[Υπο]'
                elif 'Χωρίς' in info.encode('utf-8', 'ignore'):
                    info = '[Χωρίς Υπ]'
                else:
                    info = '[N/A]'

                title = '[COLOR lime]{}[/COLOR] | [B]{}[/B] | ({})'.format(
                    info, host.capitalize(), quality.encode('utf-8'))
                addDir(title, frame, 100, iconimage, FANART, str(description))
        else:
            data = client.parseDOM(data,
                                   'table',
                                   attrs={'class': 'easySpoilerTable'})
            seasons = [
                dom.parse_dom(i, 'a', {'target': '_blank'}, req='href')
                for i in data[:-1] if i
            ]
            episodes = []
            for season in seasons:
                for epi in season:
                    title = clear_Title(epi.content.replace('×', 'x'))
                    frame = epi.attrs['href']
                    episodes.append((title, frame))

            for title, frame in episodes:
                addDir(title, frame, 100, iconimage, FANART, str(description))

    except BaseException:
        title = '[B][COLOR white]NO LINKS[/COLOR][/B]'
        addDir(title, '', 'bug', iconimage, FANART, str(description))
    views.selectView('movies', 'movie-view')