示例#1
0
def resolve(name, url, iconimage, description):
    xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}'.format(urllib.quote_plus(client.agent()))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        url = base_url + url if url.startswith('/') else url
        info = client.request(url, headers=headers)
        head = client.parseDOM(info, 'title')[0].encode('utf-8')
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''\,url:['"](.+?)['"]\}''', info, re.DOTALL)[0]
        link += '|User-Agent={}&Referer={}'.format(
            urllib.quote_plus(client.agent()), urllib.quote_plus(url))
        liz = xbmcgui.ListItem(head, iconImage=ICON, thumbnailImage=poster)

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(link))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
示例#2
0
def get_content(url):  # 5 <div id="content"><div class="container">
    r = six.ensure_str(client.request(url, headers=headers))
    data = client.parseDOM(r, 'div', attrs={'class': 'container'})[0]
    data = dom.parse_dom(data, 'a', req='href')
    data = [i for i in data if 'subt' in i.content]
    # xbmc.log('DATA22: {}'.format(str(data)))
    for item in data:
        link = item.attrs['href']
        if link == '#':
            continue
        link = client.replaceHTMLCodes(link)

        name = client.parseDOM(item.content, 'img', ret='alt')[0]
        name = client.replaceHTMLCodes(name)

        desc = client.parseDOM(item.content, 'p', attrs={'class': 'subt'})[0]
        desc = clear_Title(desc)

        try:
            poster = client.parseDOM(item.content, 'img', ret='data-src')[0]
        except IndexError:
            poster = client.parseDOM(item.content, 'img', ret='src')[0]
        poster = client.replaceHTMLCodes(poster)
        poster = 'https:' + poster if poster.startswith('//') else poster

        if six.PY2:
            link = link.encode('utf-8')
            name = name.encode('utf-8')
            desc = desc.decode('ascii', errors='ignore')
            poster = poster.encode('utf-8')
        link = '{}/{}'.format(base_url, link)
        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 100, poster, '',
               desc)

    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#3
0
def get_stream(url):  # 4
    data = base64.b64decode(unquote(url))
    # xbmc.log('@#@DATAAAA:%s' % data, xbmc.LOGINFO)
    if b'info_outline' in data:
        control.infoDialog(
            "[COLOR gold]No Links available ATM.\n [COLOR lime]Try Again Later![/COLOR]",
            NAME, iconimage, 5000)
        return
    else:
        links = list(
            zip(client.parseDOM(str(data), 'a', ret='href'),
                client.parseDOM(str(data), 'a')))
        # xbmc.log('@#@STREAMMMMMSSSSSS:%s' % links, xbmc.LOGINFO)
        titles = []
        streams = []
        for link, title in links:
            streams.append(link)
            titles.append(title)

        if len(streams) > 1:
            dialog = xbmcgui.Dialog()
            ret = dialog.select('[COLORgold][B]Choose Stream[/B][/COLOR]',
                                titles)
            if ret == -1:
                return
            elif ret > -1:
                host = streams[ret]
                # xbmc.log('@#@STREAMMMMM:%s' % host, xbmc.LOGNOTICE)
                return resolve(host, name)
            else:
                return
        else:
            link = links[0][0]
            return resolve(link, name)
示例#4
0
def get_content(url):  #5 <div id="content"><div class="container">
    r = client.request(url, headers=headers)
    # data = client.parseDOM(r, 'div', attrs={'class': 'container'})[0]
    # xbmc.log('DATAAAA: %s' % data)
    data = client.parseDOM(r, 'li', attrs={'class': 'webcam'})
    for item in data:
        link = client.parseDOM(item, 'a', ret='href')[0]
        if link == '#':
            continue
        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')

        name = client.parseDOM(item, 'span', attrs={'class': 'title'})[0]
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        desc = client.parseDOM(item, 'span', attrs={'class': 'description'})[0]
        desc = clear_Title(desc)
        desc = desc.decode('ascii', errors='ignore')

        poster = client.parseDOM(item, 'img', ret='data-original')[0]
        poster = client.replaceHTMLCodes(poster)
        poster = 'https:' + poster if poster.startswith('//') else poster
        poster = poster.encode('utf-8')

        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 100, poster, '',
               desc)

    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#5
0
def get_categories(url):
    r = client._basic_request(url, headers=headers)
    r = client.parseDOM(r, 'div', attrs={'class': 'fullbody ptb-60'})[1]
    xbmc.log('CaTAEGORIES: %s' % str(r))
    cats = client.parseDOM(r, 'li')
    xbmc.log('CTAEGORIES: %s' % str(cats))
    for cat in cats:
        link = client.parseDOM(cat, 'a', ret='href')[0]
        title = client.parseDOM(cat, 'h5')[0]
        addDir('[B]%s[/B]' % str(title), link, 5, ICON, '', str(title))
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#6
0
def get_the_random(url):  # 3
    r = six.ensure_str(client.request(url, headers=headers))
    frame = client.parseDOM(r, 'div', attrs={'class': 'row home'})[0]
    head = client.parseDOM(frame, 'h1')[0]
    head = clear_Title(head)
    frame = client.parseDOM(frame, 'a', ret='href')[0]
    frame = base_url + frame if frame.startswith('/') else frame
    # xbmc.log('FRAME:%s' % frame)
    if six.PY2:
        head = head.encode('utf-8')
    addDir('[B][COLOR white]%s[/COLOR][/B]' % head, frame, 100, ICON, '',
           'Random Live Cam')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#7
0
def resolve(name, url, iconimage, description):
    # xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}&Referer={}'.format(
            'iPad', quote_plus(headers['Referer']))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        import requests
        url = base_url + url if url.startswith('/') else url
        # xbmc.log('URLLLL2: {}'.format(url))
        # cj = client.request(base_url, headers=headers, output='cookie')
        # xbmc.log('COOKIES: {}'.format(str(cj)))
        # headers['Cookie'] = cj
        info = requests.get(url, headers=headers).text
        info = six.ensure_str(info, encoding='utf-8')
        # xbmc.log('INFOOOO: {}'.format(info))
        head = client.parseDOM(info, 'title')[0]
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''source:['"](.+?)['"]\,''', info, re.DOTALL)[0]
        link = "https://hd-auth.skylinewebcams.com/" + link.replace(
            'livee', 'live') if link.startswith('live') else link
        # xbmc.log('LINK: {}'.format(link))
        link += '|User-Agent=iPad&Referer={}'.format(BASEURL)
        if six.PY2:
            head = head.encode('utf-8')
            link = str(link)
        liz = xbmcgui.ListItem(head)
        liz.setArt({
            'icon': iconimage,
            'thumb': iconimage,
            'poster': poster,
            'fanart': fanart
        })

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(link)
        # control.player.play(link, liz)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
示例#8
0
def Get_letras(url): #9
    r = client.request(url, headers=headers)
    r = client.parseDOM(r, 'ul', attrs={'id': 'letras'})[0]
    r = client.parseDOM(r, 'li')
    for item in r:
        name = client.parseDOM(item, 'a')[0]
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        url = client.parseDOM(item, 'a', ret='href')[0]
        url = client.replaceHTMLCodes(url)
        url = url.encode('utf-8')
        addDir('[B][COLOR white]Telenovelas de %s[/COLOR][/B]' % name, url, 5, ICON, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#9
0
def get_feature(url):  #6
    r = client._basic_request(url, headers=headers)
    r = client.parseDOM(r, 'div', attrs={'class':
                                         'fullbody ptb-60 bg-dark'})[0]
    # class="fvl-productBox shadow-hover"
    posts = client.parseDOM(r,
                            'div',
                            attrs={'class': 'fvl-productBox shadow-hover'})
    for post in posts:
        if 'FREE' in post:
            link = client.parseDOM(post, 'a', ret='href')[0]
            poster = client.parseDOM(post, 'img', ret='src')[0]
            desc = client.parseDOM(post,
                                   'div',
                                   attrs={'class':
                                          'fvl-productDescription'})[0]
            title = client.parseDOM(desc, 'h5')[0]
            plot = client.parseDOM(desc, 'span')[0]
            rate = client.parseDOM(post,
                                   'div',
                                   attrs={'class': 'starrr'},
                                   ret='data-rating')[0]
            desc = title + '\n' + str(plot)
            title += '[' + str(rate) + ']'
            addDir('[B]%s[/B]' % title, link, 5, poster, '', str(desc))
        else:
            pass

    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#10
0
def get_lectures(name, url, poster, desc):
    r = client._basic_request(url, headers=headers)
    posts = client.parseDOM(r, 'li', attrs={'class': 'class-list__row'})
    for post in posts:
        link = client.parseDOM(post, 'a', ret='href')[0]
        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')

        name = client.parseDOM(post, 'a')[0]
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        addDir('[B]%s[/B]' % name, link, 100, poster, '', desc)

    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#11
0
def Episodes(url): #8
    r = client.request(url, headers=headers)
    data = client.parseDOM(r, 'ul', attrs={'id': 'listado'})[0]
    data = client.parseDOM(data, 'li')
    data = zip(client.parseDOM(data, 'a', ret='href'),
               client.parseDOM(data, 'a'))
    get_icon = client.parseDOM(r, 'img', ret='src', attrs={'class': 'transparent'})[0]

    for item in data[::-1]:
        url, title = client.replaceHTMLCodes(item[0]), client.replaceHTMLCodes(item[1])
        url = url.encode('utf-8')
        title = title.encode('utf-8')

        addDir(title, url, 10, get_icon, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#12
0
def get_country(url):  #4
    r = client.request(url, headers=headers)
    r = client.parseDOM(r, 'li', attrs={'class': 'dropdown'})[0]
    r = zip(client.parseDOM(r, 'a', attrs={'class': 'menu-item'}),
            client.parseDOM(r, 'a', attrs={'class': 'menu-item'}, ret='href'))
    for name, link in r:
        name = re.sub('<.+?>', '', name).replace('&nbsp;', ' ')
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')
        link = base_url + link if link.startswith('/') else link
        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 5, ICON, FANART,
               '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#13
0
def get_country(url):  # 4
    r = six.ensure_str(client.request(url, headers=headers))
    r = client.parseDOM(r,
                        'div',
                        attrs={'class': 'dropdown mega-dropdown live'})[0]
    r = zip(client.parseDOM(r, 'a'), client.parseDOM(r, 'a', ret='href'))
    for name, link in r:
        name = re.sub('<.+?>', '', name).replace('&nbsp;', ' ')
        name = client.replaceHTMLCodes(name)
        name = '[B][COLOR white]{}[/COLOR][/B]'.format(name)
        link = client.replaceHTMLCodes(link)
        if six.PY2:
            name = name.encode('utf-8')
            link = link.encode('utf-8')
        link = base_url + link if link.startswith('/') else link
        addDir(name, link, 5, ICON, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#14
0
def get_greek_cams():
    link = 'http://www.livecameras.gr/'
    headers = {"User-Agent": client.agent()}
    r = client.request(link, headers=headers)
    r = r.encode('utf-8')
    cams = client.parseDOM(r, 'div', attrs={'class': 'fp-playlist'})[0]
    cams = zip(client.parseDOM(cams, 'a', ret='href'),
               client.parseDOM(cams, 'a', ret='data-title'),
               client.parseDOM(cams, 'img', ret='src'))
    for stream, name, poster in cams:
        name = re.sub('".+?false', '', name)
        name = client.replaceHTMLCodes(name).encode('utf-8')
        stream = 'http:' + stream if stream.startswith('//') else stream
        stream += '|Referer={}'.format(link)
        poster = link + poster if poster.startswith('/') else poster
        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, stream, 100, poster,
               '', 'name')
示例#15
0
def GETAUTOPLAY(url):
    #progressDialog = xbmcgui.DialogProgress()
    #progressDialog.create(addon_name, 'Gathering Links For Your Selected Item: [COLOR blue]%s[/COLOR]'%name)
    #progressDialog.update(0)
    base_link = 'http://watch5s.is'
    strm_link = 'http://play.watch5s.is/grabber-api/episode/%s?token=%s'
    url = re.sub('/$', '', url)
    req = url + '/watch/'
    #Text_Box('h',req)
    referer = req
    r = client.request(req)

    if '<title>Watch Free Movies Online, Best Site to Watch Free Movies HD - WATCH5S.TO</title>' in r:
        r = client.request(url)
        part = tools.regex_from_to(r, '<div id="mv-info">', '</div>')
        url = tools.regex_from_to(part, 'href="', '"')
        r = client.request(url)
    try:
        server = tools.regex_from_to(r, '<strong>SERVER 1</strong>', '</a>')
        server = tools.regex_from_to(server, 'href="', '"')
    except:
        try:
            server = tools.regex_from_to(r, '<strong>SERVER 10</strong>',
                                         '</a>')
            server = tools.regex_from_to(server, 'href="', '"')
        except:
            server = tools.regex_from_to(r, '<strong>OpenLoad</strong>',
                                         '</a>')
            server = tools.regex_from_to(server, 'href="', '"')

    open = client.request(server)
    t = re.findall('player_type\s*:\s*"(.+?)"', open)[0]
    if not t == 'embed':

        s = client.parseDOM(open,
                            'input',
                            ret='value',
                            attrs={'name': 'episodeID'})[0]
        t = ''.join(
            random.sample(
                string.digits + string.ascii_uppercase +
                string.ascii_lowercase, 8))
        k = hashlib.md5('!@#$%^&*(' + s + t).hexdigest()
        v = hashlib.md5(t + referer + s).hexdigest()

        stream = strm_link % (s, t)
        cookie = '%s=%s' % (k, v)

        u = client.request(stream,
                           referer=referer,
                           cookie=cookie,
                           timeout='10')
        url = tools.regex_from_to(u, '"file":"', '"').replace('\/', '/')
        if not 'grabber-api' in url:
            return url
    else:
        url = tools.regex_from_to(open, 'embed_src: "', '"')
        return url
示例#16
0
def get_content(url):  #5 <div class="products-list__item shadow-hover">
    r = client._basic_request(url, headers=headers)
    # data = client.parseDOM(r, 'div', attrs={'class': 'products-view'})[0]
    data = client.parseDOM(r, 'div', attrs={'class': 'products-view__list.+?'})
    xbmc.log('DATAAA: %s' % str(data))
    for item in data:
        if 'FREE' in item:
            link = client.parseDOM(item, 'a', ret='href')[0]
            link = client.replaceHTMLCodes(link)
            link = link.encode('utf-8')

            name = client.parseDOM(item, 'a')[1]
            name = client.replaceHTMLCodes(name)
            name = name.encode('utf-8')

            desc = client.parseDOM(
                item, 'div', attrs={'class': 'product-card__description'})[0]
            desc = clear_Title(desc)
            desc = desc.decode('ascii', errors='ignore')

            univ = client.parseDOM(item,
                                   'div',
                                   attrs={'class':
                                          'product-card__category'})[0]
            un_name, un_link = [
                client.parseDOM(univ, 'a')[0],
                client.parseDOM(univ, 'a', ret='href')[0]
            ]
            un_name = re.sub('<.+?>', '', un_name)
            un_name = un_name.encode('utf-8')

            poster = client.parseDOM(item, 'img', ret='src')[0]
            poster = client.replaceHTMLCodes(poster)
            poster = 'https:' + poster if poster.startswith('//') else poster
            poster = poster.encode('utf-8')

            addDir('[B]%s[/B]' % name, link, 10, poster, '', desc)
            if not 'university' in url:
                addDir('[B]Find lectures from %s[/B]' % un_name, un_link, 5,
                       poster, '', desc)
        else:
            pass

    try:
        np = re.findall('''<li><a href="(.+?)">Next''', r, re.DOTALL)[0]
        page = np.split('/')[:-1][-1]
        page = '[B][COLORlime]{}[B][COLORwhite])[/B][/COLOR]'.format(page)
        np = client.replaceHTMLCodes(np)
        addDir(
            '[B][COLORgold]Next Page>>>[/COLOR] [COLORwhite]({}'.format(page),
            np, 5, ICON, '', 'Next Page')
    except:
        pass
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#17
0
def get_the_random(url):  #3
    r = client.request(url, headers=headers)
    frames = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'a'))
    frame = [i[0] for i in frames if 'random cam' in i[1].lower()][0]
    frame = base_url + frame if frame.startswith('/') else frame
    # xbmc.log('FRAME:%s' % frame)
    info = client.request(frame, headers=headers)
    head = client.parseDOM(info, 'title')[0].encode('utf-8')
    # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
    # name = '{0} - {1}'.format(head, title)
    # xbmc.log('NAME:%s' % head)
    poster = client.parseDOM(info,
                             'meta',
                             ret='content',
                             attrs={'property': 'og:image'})[0]
    # xbmc.log('INFO:%s' % info)
    link = re.findall(r'''\,url:['"](.+?)['"]\}''', info, re.DOTALL)[0]
    addDir('[B][COLOR white]%s[/COLOR][/B]' % head, link, 100, poster, '',
           'Random Live Cam')
示例#18
0
def get_new(url):
    r = client.request(url, headers=headers)
    r = client.parseDOM(r, 'div', attrs={'class': 'row'})[0]
    r = zip(client.parseDOM(r, 'a', ret='href'),
            client.parseDOM(r, 'img', ret='src'),
            client.parseDOM(r, 'img', ret='alt'))
    for link, poster, name in r:
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')
        link = 'https:' + link if link.startswith('//') else link

        poster = client.replaceHTMLCodes(poster)
        poster = 'https:' + poster if poster.startswith('//') else poster
        poster = poster.encode('utf-8')

        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 100, poster,
               FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#19
0
def Get_content(url):  #5
    r = client.request(url, headers=headers)
    data = client.parseDOM(r, 'div', attrs={'class': 'imagen'})
    data = zip(client.parseDOM(data, 'a', ret='href'),
               client.parseDOM(data, 'a', ret='title'),
               client.parseDOM(data, 'img', ret='src'))
    for item in data:
        link, name, icon = item[0], item[1], item[2]
        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')

        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')
        if 'capitulo' in link:
            addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 10, icon,
                   FANART, '')
        else:
            addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 8, icon,
                   FANART, '')
    try:
        np = client.parseDOM(r, 'li')
        np = [i for i in np if 'iguiente' in i][0]
        np = client.parseDOM(np, 'a', ret='href')[0]

        page = re.search('(\d+)', np, re.DOTALL)
        page = '[COLORlime]%s[/COLOR]' % page.groups()[0]

        url = urlparse.urljoin(url, np)
        url = client.replaceHTMLCodes(url)

        addDir('[B][COLORgold]Siguiente(%s)>>>[/COLOR][/B]' % page, url, 5,
               ICON, FANART, '')
    except:
        pass
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#20
0
def get_cat_cams():
    try:
        html = six.ensure_str(client.request(base_url, referer=BASEURL))
        data = client.parseDOM(html,
                               'li',
                               attrs={'class': 'dropdown mega-dropdown'})[0]
        cats = client.parseDOM(data, 'div', attrs={'class':
                                                   'container-fluid'})[0]
        cats = dom.parse_dom(cats, 'a', req='href')
        for cat in cats:
            name = client.parseDOM(cat.content, 'p', attrs={'class':
                                                            'tcam'})[0]
            if six.PY2:
                name = name.encode('utf-8')
            name = '[B][COLOR white]{}[/COLOR][/B]'.format(name)
            icon = client.parseDOM(cat.content, 'img', ret='data-src')[0]
            icon = 'https:{}'.format(icon) if icon.startswith('//') else icon
            icon = icon + '|Referer={}'.format(base_url)
            url = cat.attrs['href'][3:]
            url = '{2}/{0}/{1}'.format(web_lang, url, base_url)
            addDir(name, url, 5, icon, FANART, '')
    except BaseException:
        pass
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#21
0
def Get_links(name,url): #10
    OPEN = client.request(url, headers=headers)
    Regex = client.parseDOM(OPEN, 'iframe', ret='src')
    for link in Regex[::-1]:
        if 'verestrenos' in link:
            idp = link.split('mula=')[1]
            post = 'mole=%s' % idp
            link = client.request('http://www.verestrenos.net/rm/ajax.php', post=post)

        vid_id = re.compile('http[s]?://(.+?)\.', re.DOTALL).findall(link)[0]
        if 'sebuscar' in vid_id:
            continue
        vid_id = vid_id.replace('hqq', 'netu.tv')

        addDir('[B][COLOR white]{0} [B]| [COLOR lime]{1}[/COLOR][/B]'.format(name, vid_id), '%s|%s' % (link, url), 100, iconimage, FANART, name)
    xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例#22
0
def resolve(name, url, iconimage, description):
    url = BASEURL + url if url.startswith('/') else url
    info = client._basic_request(url, headers=headers)
    # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
    # name = '{0} - {1}'.format(head, title)
    #<div class="youtube-player" data-id="0Eeuqh9QfNI"></div>
    link_id = client.parseDOM(info,
                              'div',
                              ret='data-id',
                              attrs={'class': 'youtube-player'})[0]
    link = yout_vid.format(link_id)
    liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(link)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
示例#23
0
def get_events(url):  # 5
    data = client.request(url)
    # xbmc.log('@#@EDATAAA: {}'.format(data), xbmc.LOGNOTICE)
    events = list(
        zip(
            client.parseDOM(str(data), 'li', attrs={'class': "item itemhov"}),
            re.findall(r'<i class="material-icons">(.+?)</a> </li>', str(data),
                       re.DOTALL)))
    # addDir('[COLORcyan]Time in GMT+2[/COLOR]', '', 'BUG', ICON, FANART, '')
    for event, streams in events:
        # xbmc.log('@#@EVENTTTTT:%s' % event, xbmc.LOGNOTICE)
        watch = '[COLORlime]*[/COLOR]' if '>Live<' in event else '[COLORred]*[/COLOR]'
        try:
            teams = client.parseDOM(event, 'td')
            # xbmc.log('@#@TEAMSSSS:%s' % str(teams), xbmc.LOGNOTICE)
            home, away = re.sub(r'\s*(<img.+?>)\s*', '',
                                teams[0]), re.sub(r'\s*(<img.+?>)\s*', '',
                                                  teams[2])
            if six.PY2:
                home = home.strip().encode('utf-8')
                away = away.strip().encode('utf-8')
            teams = '[B]{0} vs {1}[/B]'.format(home, away)
        except IndexError:
            teams = client.parseDOM(event, 'center')[0]
            teams = re.sub(r'<.+?>|\s{2}', '', teams)
            teams = teams.encode('utf-8') if six.PY2 else teams
            teams = '[B]{}[/B]'.format(teams)
        # xbmc.log('@#@TEAM-FINAL:%s' % str(teams), xbmc.LOGNOTICE)
        lname = client.parseDOM(event, 'a')[1]
        lname = re.sub(r'<.+?>', '', lname)
        time = client.parseDOM(event, 'span', attrs={'class': 'gmt_m_time'})[0]
        time = time.split('GMT')[0].strip()
        cov_time = convDateUtil(
            time, 'default', 'GMT{}'.format(str(control.setting('timezone'))))
        # xbmc.log('@#@COVTIMEEE:%s' % str(cov_time), xbmc.LOGNOTICE)
        ftime = '[COLORgold][I]{}[/COLOR][/I]'.format(cov_time)
        name = '{0}{1} {2} - [I]{3}[/I]'.format(watch, ftime, teams, lname)

        # links = re.findall(r'<a href="(.+?)".+?>( Link.+? )</a>', event, re.DOTALL)
        streams = str(quote(base64.b64encode(six.ensure_binary(streams))))

        icon = client.parseDOM(event, 'img', ret='src')[0]
        icon = urljoin(BASEURL, icon)

        addDir(name, streams, 4, icon, FANART, name)
示例#24
0
def GETLINKS(url, name):
    progressDialog = xbmcgui.DialogProgress()
    progressDialog.create(addon_name,
                          'Gathering Links For: [COLOR blue]%s[/COLOR]' % name)
    progressDialog.update(0)
    name = str(name).replace(' [COLOR blue]', '').replace(
        '[/COLOR]', '').replace('CAM', '').replace('SD', '').replace('HD', '')
    name = tools.geturl(name)
    name = re.sub('-$', '', name)
    name = re.sub('^-', '', name)
    base_link = 'http://watch5s.is'
    strm_link = 'http://play.watch5s.is/grabber-api/episode/%s?token=%s'
    url = re.sub('/$', '', url)
    req = url + '/watch/'
    #Text_Box('h',req)
    referer = req
    r = client.request(req)

    if '<title>Watch Free Movies Online, Best Site to Watch Free Movies HD - WATCH5S.TO</title>' in r:
        r = client.request(url)
        part = tools.regex_from_to(r, '<div id="mv-info">', '</div>')
        url = tools.regex_from_to(part, 'href="', '"')
        r = client.request(url)

    all = tools.regex_get_all(r, '<div class="les-content">', '</div>')
    for a in all:
        try:
            u = tools.regex_from_to(a, '<a href="', '"')
            qual = tools.regex_from_to(a, 'first-ep.*?">', '<')
            p = client.request(u, referer=referer, timeout='10')

            t = re.findall('player_type\s*:\s*"(.+?)"', p)[0]
            if not t == 'embed':

                s = client.parseDOM(p,
                                    'input',
                                    ret='value',
                                    attrs={'name': 'episodeID'})[0]
                t = ''.join(
                    random.sample(
                        string.digits + string.ascii_uppercase +
                        string.ascii_lowercase, 8))
                k = hashlib.md5('!@#$%^&*(' + s + t).hexdigest()
                v = hashlib.md5(t + referer + s).hexdigest()

                stream = strm_link % (s, t)
                cookie = '%s=%s' % (k, v)

                u = client.request(stream,
                                   referer=referer,
                                   cookie=cookie,
                                   timeout='10')
                url = tools.regex_from_to(u, '"file":"', '"')
                if not 'grabber-api' in url:
                    host = 'GVIDEO'
                    addDir('%s | [COLOR blue]%s[/COLOR]' % (host, qual),
                           urllib.quote_plus(str(url).replace('\/', '/')), 7,
                           icon, fanart, '')
            else:
                url = tools.regex_from_to(p, 'embed_src: "', '"')
                if 'openload' in url:
                    host = 'OPENLOAD'
                addDir('%s | [COLOR blue]%s[/COLOR]' % (host, qual), url, 7,
                       icon, fanart, '')
        except:
            pass

    progressDialog.close()
示例#25
0
    def get(self, query):
        try:
            query, imdb = query.split('/imdb=')
            match = re.findall(r'^(?P<title>.+)[\s+\(|\s+](?P<year>\d{4})',
                               query)
            if len(match) > 0:
                title, year = match[0][0], match[0][1]
                if imdb.startswith('tt'):
                    url = 'https://yifysubtitles.org/movie-imdb/{}'.format(
                        imdb)
                    r = six.ensure_text(client.request(url))

                else:
                    url = urljoin(self.base_link,
                                  self.search.format(quote_plus(title)))
                    r = six.ensure_text(client.request(url))
                    data = client.parseDOM(r,
                                           'div',
                                           attrs={
                                               'class': 'media-body'
                                           })  # <div class="media-body">
                    for i in data:
                        try:
                            name = client.parseDOM(i, 'h3')[0].encode('utf-8')
                            if not cleantitle.get(title) == cleantitle.get(
                                    client.replaceHTMLCodes(name)):
                                raise Exception()
                            y = re.search(r'">(\d{4})<small>year</small>',
                                          i).groups()[0]
                            if not year == y:
                                raise Exception()
                            url = client.parseDOM(i, 'a', ret='href')[0]
                            url = url.encode('utf-8')
                            url = urljoin(self.base_link, url)
                            r = client.request(url)
                        except BaseException:
                            pass

                data = client.parseDOM(r, 'tr', attrs={'data-id': r'\d+'})
                items = [i for i in data if 'greek' in i.lower()]
                # xbmc.log('$#$MATCH-YIFI-RRR: %s' % items)
                urls = []
                for item in items:
                    try:
                        # rating = client.parseDOM(item, 'span', attrs={'title': 'rating'})[0]
                        name = client.parseDOM(item, 'a')[0]
                        name = re.sub(r'<.+?>', '',
                                      name).replace('subtitle', '')
                        name = client.replaceHTMLCodes(name)

                        url = client.parseDOM(item, 'a', ret='href')[0]
                        url = client.replaceHTMLCodes(url)

                        if six.PY2:
                            url = url.encode('utf-8')
                            name = name.encode('utf-8')
                        urls += [(name, url)]
                    except BaseException:
                        pass
            else:
                return self.list

        except BaseException:
            return

        for i in urls:
            try:
                r = six.ensure_text(
                    client.request(urljoin(self.base_link, i[1])))
                url = client.parseDOM(
                    r,
                    'a',
                    ret='href',
                    attrs={'class': 'btn-icon download-subtitle'})[0]
                url = 'https://yifysubtitles.org/' + url if url.startswith(
                    '/') else url
                self.list.append({
                    'name': i[0],
                    'url': url,
                    'source': 'yifi',
                    'rating': '5'
                })
            except BaseException:
                pass

        return self.list
示例#26
0
    def get(self, query):
        try:
            query, imdb = query.split('/imdb=')
            match = re.findall('^(?P<title>.+)[\s+\(|\s+](?P<year>\d{4})',
                               query)

            cookie = self.s.get('https://subztv.online/',
                                headers=self.hdr).cookies
            cj = requests.utils.dict_from_cookiejar(cookie)

            if len(match) > 0:

                title, year = match[0][0], match[0][1]

                if imdb.startswith('tt'):
                    frame = 'https://subztv.online/view/%s' % imdb
                    r = self.s.get(frame)
                    r = re.sub(r'[^\x00-\x7F]+', ' ', r.content)
                else:
                    url = 'https://subztv.online/search/%s/movies' % urllib.quote(
                        title)

                    data = self.s.get(url).content
                    data = client.parseDOM(data, 'span', attrs={'class': 'h5'})
                    data = [(client.parseDOM(i, 'a')[0],
                             client.parseDOM(i, 'a', ret='href')[0])
                            for i in data if i]

                    frame = [
                        i[1] for i in data
                        if cleantitle.get(i[0]) == cleantitle.get(title)
                    ][0]

                    r = self.s.get(frame).text
                    r = re.sub(r'[^\x00-\x7F]+', ' ', r)

                secCode = client.parseDOM(r,
                                          'input',
                                          ret='value',
                                          attrs={'id': 'secCode'})[0]
                items = client.parseDOM(r, 'tbody')[0]
                items = client.parseDOM(items, 'tr')

            else:
                title, season, episode = re.findall(
                    '^(?P<title>.+)\s+S(\d+)E(\d+)', query, re.I)[0]
                #xbmc.log('$#$MATCH-SUBZ: %s | %s | %s' % (title, season, episode), xbmc.LOGNOTICE)

                season, episode = '%01d' % int(season), '%01d' % int(episode)
                hdlr = 'season-%s-episode-%s' % (season, episode)

                if imdb.startswith('tt'):
                    r = self.s.get('https://subztv.online/view/%s' %
                                   imdb).content
                    # xbmc.log('$#$MATCH-SUBZ-RRR-source: %s' % r)
                    #r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                    frames = client.parseDOM(r, 'a', ret='href')
                    frame = [i for i in frames if hdlr in i][0]
                else:
                    baseurl = ' https://api.thetvdb.com/login'
                    series_url = 'https://api.thetvdb.com/series/%s'
                    greek_api = 'CAYAM6RT1K2SERUE'
                    user_key = '7F5420E18BAD7762'
                    username = '******'

                    _headers = {
                        'Content-Type': 'application/json',
                        'Accept': 'application/json',
                        'Connection': 'close'
                    }

                    post = {
                        "apikey": greek_api,
                        "username": username,
                        "userkey": user_key
                    }

                    # data = requests.post(baseurl, data=json.dumps(post), headers=_headers).json()
                    data = client.request(baseurl,
                                          post=json.dumps(post),
                                          headers=_headers)

                    auth = 'Bearer %s' % urllib.unquote_plus(
                        json.loads(data)['token'])
                    _headers['Authorization'] = auth

                    series_data = client.request(series_url % imdb,
                                                 headers=_headers)
                    imdb = json.loads(series_data)['data']['imdbId']
                    #xbmc.log('$#$MATCH-SUBZ-RRR-IMDB: %s' % imdb)
                    r = self.s.get('https://subztv.online/view/%s' %
                                   imdb).content
                    # xbmc.log('$#$MATCH-SUBZ-RRR-source: %s' % r)
                    #r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                    frames = client.parseDOM(r, 'a', ret='href')
                    frame = [i for i in frames if hdlr in i][0]

                #xbmc.log('$#$MATCH-SUBZ-λινκ: %s' % frame)
                r = self.s.get(frame).text
                r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                secCode = client.parseDOM(r,
                                          'input',
                                          ret='value',
                                          attrs={'id': 'secCode'})[0]
                items = client.parseDOM(r, 'tbody')[0]
                items = client.parseDOM(items, 'tr')

        except BaseException:
            return

        for item in items:
            try:

                try:
                    imdb = re.search('\/(tt\d+)\/', frame).groups()[0]
                except BaseException:
                    imdb = re.search('\/(tt\d+)', frame).groups()[0]

                data = re.findall(
                    '''downloadMe\(['"](\w+\-\w+).+?label.+?>(\d+).+?<td>(.+?)</td''',
                    str(item), re.I | re.DOTALL)[0]

                name = data[2]
                name = client.replaceHTMLCodes(name)
                name = name.encode('utf-8')

                url = 'https://subztv.online/dll/{}/0/{}'.format(
                    data[0], secCode)
                url = client.replaceHTMLCodes(url)
                url = url.encode('utf-8')

                down = data[1]
                rating = self._rating(down)

                self.list.append({
                    'name':
                    name,
                    'url':
                    '%s|%s|%s|%s|%s|%s' %
                    (frame.encode('utf-8'), url, cj['__cfduid'],
                     cj['PHPSESSID'], name, imdb),
                    'source':
                    'subztv',
                    'rating':
                    rating
                })

            except BaseException:
                pass

        return self.list
示例#27
0
    def download(self, path, url):

        try:
            frame, url, cjcfduid, cjphp, sub_, imdb_ = url.split('|')
            # xbmc.log('$#$ FRAME: %s | URL: %s | COOKIE: %s | SUB: %s | imdb: %s | ' % (frame, url, cjcfduid, sub_, imdb_))

            sub_ = urllib.unquote_plus(sub_)

            self.s.cookies.update({'__cfduid': cjcfduid, 'PHPSESSID': cjphp})
            # xbmc.log('$#$ FRAME-COOKIES: %s' % self.s.cookies)

            self.s.headers['Referer'] = frame
            init = self.s.get(url).text
            try:
                imdb = client.parseDOM(init,
                                       'input',
                                       ret='value',
                                       attrs={'name': 'uid'})[0]
            except IndexError:
                imdb = imdb_
            try:
                sub_name = client.parseDOM(init,
                                           'input',
                                           ret='value',
                                           attrs={'name': 'output'})[0]
            except IndexError:
                sub_name = '{}.srt'.format(sub_)

            self.s.headers.update({
                'Referer': url,
                'Origin': 'https://subztv.online'
            })

            # xbmc.log('$#$ FRAME-HEADERS: %s' % self.s.headers, xbmc.LOGNOTICE)
            post = {
                "langcode": "el",
                "uid": imdb,
                "output": sub_name.lower(),
                "dll": "1"
            }
            # post = urllib.urlencode(post)
            # xbmc.log('$#$ FRAME-POST: %s' % post)

            result = self.s.post(url, data=post)
            #xbmc.log('$#$POST-RESUL: %s' % result.content)
            f = os.path.join(path, urllib.quote(sub_) + '.srt')
            with open(f, 'wb') as subFile:
                subFile.write(result.content)

            dirs, files = control.listDir(path)

            if len(files) == 0:
                return

            if not f.lower().endswith('.rar'):
                control.execute('Extract("%s","%s")' % (f, path))

            if control.infoLabel('System.Platform.Windows'):
                conversion = urllib.quote
            else:
                conversion = urllib.quote_plus

            if f.lower().endswith('.rar'):

                uri = "rar://{0}/".format(conversion(f))
                dirs, files = control.listDir(uri)

            else:

                for i in range(0, 10):

                    try:
                        dirs, files = control.listDir(path)
                        if len(files) > 1:
                            break
                        if control.aborted is True:
                            break
                        control.wait(1)
                    except BaseException:
                        pass

            filename = [
                i for i in files if any(
                    i.endswith(x) for x in ['.srt', '.sub'])
            ][0].decode('utf-8')
            subtitle = os.path.join(path, filename)

            if f.lower().endswith('.rar'):

                content = control.openFile(uri + filename).read()

                with open(subtitle, 'wb') as subFile:
                    subFile.write(content)

                return subtitle

            else:

                return subtitle

        except BaseException:
            pass
示例#28
0
def resolve(url, name):
    # xbmc.log('RESOLVE-URL: %s' % url, xbmc.LOGNOTICE)
    ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36'
    # dialog.notification(AddonTitle, '[COLOR skyblue]Attempting To Resolve Link Now[/COLOR]', icon, 5000)
    if 'acestream' in url:
        url1 = "plugin://program.plexus/?url=" + url + "&mode=1&name=acestream+"
        liz = xbmcgui.ListItem(name)
        liz.setArt({'poster': 'poster.png', 'banner': 'banner.png'})
        liz.setArt({
            'icon': iconimage,
            'thumb': iconimage,
            'poster': iconimage,
            'fanart': fanart
        })
        liz.setPath(url)
        xbmc.Player().play(url1, liz, False)
        quit()
    if '/live.cdnz' in url:
        r = six.ensure_str(client.request(url,
                                          referer=BASEURL)).replace('\t', '')
        # xbmc.log("[{}] - HTML: {}".format(ADDON.getAddonInfo('id'), str(r)))
        from resources.modules import jsunpack
        if 'script>eval' in r:
            unpack = re.findall(r'''<script>(eval.+?\{\}\)\))''', r,
                                re.DOTALL)[0]
            r = jsunpack.unpack(unpack.strip())
            # xbmc.log('RESOLVE-UNPACK: %s' % str(r), xbmc.LOGNOTICE)
        else:
            r = r
        # xbmc.log("[{}] - HTML: {}".format(ADDON.getAddonInfo('id'), str(r)))
        if 'hfstream.js' in r:
            regex = '''<script type='text/javascript'> width=(.+?), height=(.+?), channel='(.+?)', g='(.+?)';</script>'''
            wid, heig, chan, ggg = re.findall(regex, r, re.DOTALL)[0]
            stream = 'https://www.playerfs.com/membedplayer/' + chan + '/' + ggg + '/' + wid + '/' + heig + ''
        else:
            if 'cbox.ws/box' in r:
                try:
                    stream = client.parseDOM(r,
                                             'iframe',
                                             ret='src',
                                             attrs={'id': 'thatframe'})[0]
                except IndexError:
                    streams = client.parseDOM(r, 'iframe', ret='src')
                    stream = [i for i in streams if not 'adca.' in i][0]
                    # xbmc.log("[{}] - STREAM: {}".format(ADDON.getAddonInfo('id'), str(stream)))
            else:
                stream = client.parseDOM(r, 'iframe', ret='src')[-1]
                # xbmc.log("[{}] - STREAM-ELSE: {}".format(ADDON.getAddonInfo('id'), str(stream)))
        # xbmc.log("[{}] - STREAM: {}".format(ADDON.getAddonInfo('id'), str(stream)))
        rr = client.request(stream, referer=url)
        rr = six.ensure_text(rr, encoding='utf-8').replace('\t', '')
        if 'eval' in rr:
            unpack = re.findall(r'''script>(eval.+?\{\}\))\)''', rr,
                                re.DOTALL)[0]
            # unpack = client.parseDOM(rr, 'script')
            # xbmc.log('UNPACK: %s' % str(unpack))
            # unpack = [i.rstrip() for i in unpack if 'eval' in i][0]
            rr = six.ensure_text(jsunpack.unpack(str(unpack) + ')'),
                                 encoding='utf-8')
        else:
            r = rr
        if 'youtube' in rr:
            try:
                flink = client.parseDOM(r, 'iframe', ret='src')[0]
                fid = flink.split('/')[-1]
            except IndexError:
                fid = re.findall(r'''/watch\?v=(.+?)['"]''', r, re.DOTALL)[0]
            # xbmc.log('@#@STREAMMMMM111: %s' % fid, xbmc.LOGNOTICE)

            flink = 'plugin://plugin.video.youtube/play/?video_id={}'.format(
                str(fid))
            # xbmc.log('@#@STREAMMMMM111: %s' % flink, xbmc.LOGNOTICE)

        else:
            if '<script>eval' in rr and not '.m3u8?':
                unpack = re.findall(r'''<script>(eval.+?\{\}\))\)''', rr,
                                    re.DOTALL)[0].strip()
                # xbmc.log("[{}] - STREAM-UNPACK: {}".format(ADDON.getAddonInfo('id'), str(unpack)))
                rr = jsunpack.unpack(str(unpack) + ')')
                # xbmc.log("[{}] - STREAM-UNPACK: {}".format(ADDON.getAddonInfo('id'), str(r)))
            # else:
            #     xbmc.log("[{}] - Error unpacking".format(ADDON.getAddonInfo('id')))
            if 'player.src({src:' in rr:
                flink = re.findall(r'''player.src\(\{src:\s*["'](.+?)['"]\,''',
                                   rr, re.DOTALL)[0]
                # xbmc.log('@#@STREAMMMMM: %s' % flink, xbmc.LOGNOTICE)
            elif 'hlsjsConfig' in rr:
                xbmc.log('MALAKASSSSS26')
                flink = re.findall(r'''src=\s*["'](.+?)['"]''', rr,
                                   re.DOTALL)[0]
            elif 'new Clappr' in rr:
                flink = re.findall(r'''source\s*:\s*["'](.+?)['"]\,''',
                                   str(rr), re.DOTALL)[0]
            elif 'player.setSrc' in rr:
                flink = re.findall(r'''player.setSrc\(["'](.+?)['"]\)''', rr,
                                   re.DOTALL)[0]

            else:
                try:
                    flink = re.findall(r'''source:\s*["'](.+?)['"]''', rr,
                                       re.DOTALL)[0]
                except IndexError:
                    ea = re.findall(r'''ajax\(\{url:\s*['"](.+?)['"],''', rr,
                                    re.DOTALL)[0]
                    ea = six.ensure_text(client.request(ea)).split('=')[1]
                    flink = re.findall('''videoplayer.src = "(.+?)";''', ea,
                                       re.DOTALL)[0]
                    flink = flink.replace('" + ea + "', ea)
            flink += '|Referer={}'.format(quote(stream))
        # xbmc.log('@#@STREAMMMMM111: %s' % flink, xbmc.LOGNOTICE)
        stream_url = flink

    else:
        stream_url = url
    liz = xbmcgui.ListItem(name)
    liz.setArt({'poster': 'poster.png', 'banner': 'banner.png'})
    liz.setArt({
        'icon': iconimage,
        'thumb': iconimage,
        'poster': iconimage,
        'fanart': fanart
    })
    liz.setInfo(type="Video", infoLabels={"Title": name})
    liz.setProperty("IsPlayable", "true")
    liz.setPath(str(stream_url))
    # if float(xbmc.getInfoLabel('System.BuildVersion')[0:4]) >= 17.5:
    #     liz.setMimeType('application/vnd.apple.mpegurl')
    #     liz.setProperty('inputstream.adaptive.manifest_type', 'hls')
    #     liz.setProperty('inputstream.adaptive.stream_headers', str(headers))
    # else:
    #     liz.setProperty('inputstreamaddon', None)
    #     liz.setContentLookup(True)
    xbmc.Player().play(stream_url, liz, False)
    quit()
示例#29
0
    def get(self, query):
        try:
            match = re.findall('(.+?) \((\d{4})\)/imdb=$', query)

            if len(match) > 0:

                title, year = match[0][0], match[0][1]

                query = ' '.join(
                    urllib.unquote_plus(
                        re.sub('%\w\w', ' ',
                               urllib.quote_plus(title))).split())

                url = 'https://subz.xyz/search?q=%s' % urllib.quote_plus(query)

                result = client.request(url)
                result = re.sub(r'[^\x00-\x7F]+', ' ', result)

                url = client.parseDOM(result,
                                      'section',
                                      attrs={'class': 'movies'})[0]
                url = re.findall('(/movies/\d+)', url)
                url = [x for y, x in enumerate(url) if x not in url[:y]]
                url = [urljoin('https://subz.xyz', i) for i in url]
                url = url[:3]

                for i in url:
                    c = cache.get(self.cache, 2200, i)

                    if c is not None:
                        if cleantitle.get(c[0]) == cleantitle.get(
                                title) and c[1] == year:
                            try:
                                item = self.r
                            except:
                                item = client.request(i)
                            break

            else:

                title, season, episode = re.findall(
                    '(.+?) S(\d+)E(\d+)/imdb=$', query)[0]

                season, episode = '%01d' % int(season), '%01d' % int(episode)

                query = ' '.join(
                    urllib.unquote_plus(
                        re.sub('%\w\w', ' ',
                               urllib.quote_plus(title))).split())

                url = 'https://subz.xyz/search?q=%s' % urllib.quote_plus(query)

                result = client.request(url)
                result = re.sub(r'[^\x00-\x7F]+', ' ', result)

                url = client.parseDOM(result,
                                      'section',
                                      attrs={'class': 'tvshows'})[0]
                url = re.findall('(/series/\d+)', url)
                url = [x for y, x in enumerate(url) if x not in url[:y]]
                url = [urljoin('https://subz.xyz', i) for i in url]
                url = url[:3]

                for i in url:
                    c = cache.get(self.cache, 2200, i)

                    if c is not None:
                        if cleantitle.get(c[0]) == cleantitle.get(title):
                            item = i
                            break

                item = '%s/seasons/%s/episodes/%s' % (item, season, episode)
                item = client.request(item)

            item = re.sub(r'[^\x00-\x7F]+', ' ', item)
            items = client.parseDOM(item, 'tr', attrs={'data-id': '.+?'})
        except:
            return

        for item in items:
            try:

                r = client.parseDOM(item, 'td', attrs={'class': '.+?'})[-1]

                url = client.parseDOM(r, 'a', ret='href')[0]
                url = client.replaceHTMLCodes(url)
                url = url.replace("'", "").encode('utf-8')

                name = url.split('/')[-1].strip()
                name = re.sub('\s\s+', ' ', name)
                name = name.replace('_', '').replace('%20', '.')
                name = client.replaceHTMLCodes(name)
                name = name.encode('utf-8')

                self.list.append({
                    'name': name,
                    'url': url,
                    'source': 'subzxyz',
                    'rating': 5
                })
            except:
                pass

        return self.list
示例#30
0
    def get(self, query):
        try:
            query, imdb = query.split('/imdb=')
            match = re.findall(r'^(?P<title>.+)[\s+\(|\s+](?P<year>\d{4})', query)
            # xbmc.log('$#$MATCH-S4F: %s' % match, xbmc.LOGNOTICE)

            if len(match) > 0:
                hdr = {
                    'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3',
                    'Referer': 'https://www.subs4free.info/'}

                title, year = match[0][0], match[0][1]

                query = quote_plus('{} {}'.format(title, year))

                url = urljoin(self.base_link, self.search % query)

                req = requests.get(url, headers=hdr)
                cj = req.cookies
                r = req.text
                # r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                if six.PY2:
                    r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                # try:
                #     r = r.decode('utf-8', errors='replace')
                # except UnicodeEncodeError:
                #     pass
                # xbmc.log('$#$HTML: %s' % r, xbmc.LOGNOTICE)

                urls = client.parseDOM(r, 'div', attrs={'class': 'movie-download'})
                # urls += client.parseDOM(r, 'div', attrs={'class': ' seeMedium'})
                # xbmc.log('$#$URLS-start: %s' % urls, xbmc.LOGNOTICE)
                urls = [i for i in urls if '/greek-sub' in i]
                # urls = [(client.parseDOM(i, 'tr')[0], re.findall(r'<b>(\d+)</b>DLs', i, re.I)[0]) for i in urls if i]
                urls = [(client.parseDOM(i, 'a', ret='href')[0],
                         client.parseDOM(i, 'a', ret='title')[0],
                         re.findall(r'<b>(\d+)</b>DLs', i, re.I)[0]) for i in urls if i]
                # xbmc.log('$#$URLS: %s' % urls, xbmc.LOGNOTICE)
                urls = [(urljoin(self.base_link, i[0]), i[1].split('for ', 1)[1],
                         i[2]) for i in urls if i]
                urls = [(i[0], i[1], i[2]) for i in urls if i]
                # xbmc.log('$#$URLS: %s' % urls, xbmc.LOGNOTICE)


            else:
                hdr = {
                    'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3',
                    'Referer': 'https://www.subs4series.com/'}
                title, hdlr = re.findall(r'^(?P<title>.+)\s+(?P<hdlr>S\d+E\d+)', query, re.I)[0]
                # xbmc.log('$#$MATCH-S4F: %s | %s' % (title, hdlr), xbmc.LOGNOTICE)

                # hdlr = 'S%02dE%02d' % (int(season), int(episode))

                query = quote('{} {}'.format(title, hdlr))

                url = urljoin(self.base_TVlink, self.search % query)

                req = requests.get(url, headers=hdr)

                cj = req.cookies
                r = req.text
                if six.PY2:
                    r = re.sub(r'[^\x00-\x7F]+', ' ', r)
                # try:
                #     r = r.decode('utf-8', errors='replace')
                # except UnicodeEncodeError:
                #     pass
                # xbmc.log('@@URL:%s' % r)

                urls = client.parseDOM(r, 'div', attrs={'class': ' seeDark'})
                urls += client.parseDOM(r, 'div', attrs={'class': ' seeMedium'})
                urls = [i for i in urls if not '/en.gif' in i]
                urls = [(client.parseDOM(i, 'tr')[0], re.findall(r'<B>(\d+)</B>DLs', i, re.I)[0]) for i in urls if i]
                urls = [(client.parseDOM(i[0], 'a', ret='href')[0],
                         client.parseDOM(i[0], 'a', ret='title')[0], i[1]) for i in urls if i]
                urls = [(urljoin(self.base_TVlink, i[0]), re.sub('Greek subtitle[s] for ', '', i[1]),
                         i[2]) for i in urls if i]
                urls = [(i[0], i[1], i[2]) for i in urls if i]

        except BaseException:
            return

        for i in urls:
            try:
                rating = str(self._rating(i[2]))
                name = i[1].replace('_', '').replace('%20', '.')
                name = client.replaceHTMLCodes(name)
                name = six.ensure_str(name, 'utf-8')
                url = i[0]
                url = client.replaceHTMLCodes(url)
                url = six.ensure_str(url, 'utf-8')

                self.list.append({'name': name, 'url': '{}|{}'.format(url, cj['PHPSESSID']),
                                  'source': 's4f', 'rating': rating})
            except BaseException:
                pass

        return self.list