示例#1
0
def getHosterUrl(sUrl=False):
    if 'gounlimited' in sUrl:
        sHtmlContent = cRequestHandler(sUrl).request()
        isMatch, aResult = cParser().parse(sHtmlContent, "(eval\(function.*?)</script>")
        if isMatch:
            from resources.lib import jsunpacker
            unpacked = jsunpacker.unpack(aResult[1])
            isMatch, sUrl = cParser.parseSingleResult(unpacked, 'sources[^>][^>]"([^"]+)')
        if isMatch:
            return [{'streamUrl': sUrl, 'resolved': True}]
    else:
        return [{'streamUrl': sUrl, 'resolved': False}]
示例#2
0
def parseHosterDirect(sHtmlContent, sHoster='', sMovieTitle=''):
    oParser = cParser()
    #Link oder Iframe suchen der den Hosternamen enthält
    sPattern = 'id="maincontent5".*?(?:target="_blank" href|iframe[^<]+src|value)="([^"]+)".*?id="underplayer">'
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sStreamUrl = aResult[1][0]

        # Stream4k
        if 'http' not in sStreamUrl:
            oRequest = cRequestHandler(URL_MAIN + '/' + sStreamUrl)
            oRequest.removeBreakLines(False)
            oRequest.removeNewLines(False)
            sHtml = oRequest.request()

            isMatch, aResult = cParser.parse(sHtml,
                                             '(eval\(function.*?)</script>')

            if isMatch:
                from resources.lib import jsunpacker
                import json

                unpacked = jsunpacker.unpack(aResult[0])
                isMatch, sJson = cParser.parseSingleResult(
                    unpacked, '(\[{".*?}\])')

                if isMatch:
                    results = []
                    for entry in json.loads(sJson):
                        if 'file' not in entry or 'label' not in entry:
                            continue
                        result = dict()
                        result['streamUrl'] = entry['file']
                        result['title'] = entry['label'].encode('utf-8')
                        result['resolved'] = False
                        results.append(result)
                    return results
        else:
            result = {}
            result['streamUrl'] = sStreamUrl
            result['resolved'] = False
            return result
    return False
示例#3
0
def showHosters():
    params = ParameterHandler()
    sUrl = params.getValue('entryUrl')
    sHtmlContent = cRequestHandler(sUrl).request()

    sPattern = '<iframe[^>]*class="metaframe"[^>]*src="([^"]+)"[^>]*>'  # url
    isMatch, streamUrl = cParser.parseSingleResult(sHtmlContent, sPattern)

    if not isMatch:
        return []

    sHtmlContent = cRequestHandler(streamUrl).request()
    isMatch, aResult = cParser.parse(sHtmlContent,
                                     '(eval\(function.*?)</script>')
    if isMatch:
        for packed in aResult:
            sHtmlContent += jsunpacker.unpack(packed)

    isMatch, aResult = cParser.parse(sHtmlContent, '(\[{".*?}\])')
    if not isMatch:
        logger.info("hoster pattern did not match")
        return []

    hosters = []
    for sJson in aResult:
        for entry in json.loads(sJson):
            if 'file' not in entry or 'label' not in entry or 'type' not in entry:
                continue
            sLabel = entry['label'].encode('utf-8')
            hoster = dict()
            hoster['link'] = entry['file']
            if entry['label'].encode('utf-8')[:-1] in QUALITY_ENUM:
                hoster['quality'] = QUALITY_ENUM[entry['label'].encode('utf-8')
                                                 [:-1]]
            hoster['name'] = sLabel
            hosters.append(hoster)

    if hosters:
        hosters.append('playStream')
    return hosters
def showHosters():
    oParams = ParameterHandler()
    sUrl = oParams.getValue('entryUrl')
    sHtmlContent = __getContent(sUrl)
    sPattern = 'src="([^"]+)"[^>]*frameborder'  # url
    aResult = cParser().parse(sHtmlContent, sPattern)
    hosters = []
    if aResult[1]:
        for hUrl in aResult[1]:
            if 'view.php' in hUrl:
                oRequest = cRequestHandler(hUrl, ignoreErrors=True)
                sHtmlContent = oRequest.request()
                aResult = cParser.parse(sHtmlContent,
                                        '"file":"([^"]+).*?label":"([^"]+)')
                for sUrl, sQuality in aResult[1]:
                    sQuality = sQuality.lower()
                    hoster = {
                        'link': sUrl,
                        'name': sQuality,
                        'quality': QUALITY_ENUM[sQuality]
                    }
                    hosters.append(hoster)

            if 'rapidvideo' in hUrl:
                oRequest = cRequestHandler(hUrl, ignoreErrors=True)
                oRequest.addHeaderEntry('Referer', sUrl)
                sHtmlContent = oRequest.request()
                aResult = cParser.parse(sHtmlContent,
                                        '<a[^>]*href="([^"]+)">.*?">([^<]+)')
                for sUrl, sQuality in aResult[1]:
                    sQuality = sQuality.lower()
                    hoster = {
                        'link': sUrl,
                        'name': 'Rapidvideo ' + sQuality,
                        'quality': QUALITY_ENUM[sQuality]
                    }
                    hosters.append(hoster)

            if 'wp-embed.php' in hUrl:
                oRequest = cRequestHandler(hUrl, ignoreErrors=True)
                oRequest.addHeaderEntry('Referer', sUrl)
                sHtmlContent = oRequest.request()
                aResult = cParser.parse(sHtmlContent,
                                        '{file: "([^"]+).*?label: "([^"]+)')
                for sUrl, sQuality in aResult[1]:
                    sQuality = sQuality.lower()
                    hoster = {
                        'link': sUrl,
                        'name': sQuality,
                        'quality': QUALITY_ENUM[sQuality]
                    }
                    hosters.append(hoster)

            if 'play' in hUrl:
                oRequest = cRequestHandler(hUrl, ignoreErrors=True)
                oRequest.addHeaderEntry('Referer', sUrl)
                sHtmlContent = oRequest.request()
                isMatch, aResult = cParser.parse(
                    sHtmlContent, '(eval\s*\(function.*?)</script>')
                if isMatch:
                    for packed in aResult:
                        try:
                            sHtmlContent += jsunpacker.unpack(packed)
                        except:
                            pass

                    isMatch, aResult = cParser.parse(
                        sHtmlContent, 'file":"([^"]+)","label":"([^"]+)"')
                    for sUrl, sQuality in aResult:
                        sQuality = sQuality.lower()
                        hoster = {
                            'link': sUrl,
                            'name': sQuality,
                            'quality': QUALITY_ENUM[sQuality]
                        }
                        hosters.append(hoster)

            if 'youtube' in hUrl:
                hoster = {'link': hUrl, 'name': 'Youtube [Trailer]'}
                hosters.append(hoster)

    if hosters:
        hosters.append('getHosterUrl')
    return hosters