Пример #1
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.comedyportal.net/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        match = re.compile("id='pl'.+?data='(.+?)'").findall(html)
        html = HttpUtils.HttpClient().getHtmlContent(
            url=match[0].replace(' ', '%20'))
        video_link = re.compile("file : '(.+?)'").findall(html)[0].replace(
            ' ', '%20')
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #2
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:

        video_link = "http://www.vioku.com/flvideo/" + video_id
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #3
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://veevr.com/embed/' + str(video_id)
        soup = HttpUtils.HttpClient().getBeautifulSoup(url=video_info_link)
        thumbTag = soup.findChild('img', attrs={'id':'vid-thumb'})
        imageUrl = thumbTag['src']
        videoTitle = thumbTag['alt']
        
        vidTag = soup.findChild('img', attrs={'id':'smil-load'})
        videoUrl = vidTag['src']
        video_info.add_video_link(VIDEO_QUAL_SD, videoUrl)
        video_info.set_video_name(videoTitle)
        video_info.set_video_image(imageUrl)
        video_info.set_video_stopped(False)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #4
0
def retrieveAudioInfo(audioUrl):
    url = 'https://api.soundcloud.com/' + audioUrl
    jObj = json.loads(HttpUtils.HttpClient().getHtmlContent(url=url))
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(url)
    video_info.add_video_link(VIDEO_QUAL_SD, jObj['http_mp3_128_url'], addUserAgent=False, addReferer=False)
    video_info.set_video_image('')
    video_info.set_video_name('')
    
    Logger.logDebug(jObj['http_mp3_128_url'])
    video_info.set_video_stopped(False)
    return video_info
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        sequence = re.compile('"sequence":"(.+?)"').findall(html)
        newseqeunce = urllib.unquote(sequence[0]).decode('utf8').replace('\\/', '/')
        #        jsonObj = json.loads(newseqeunce, encoding='utf-8')
        #        print jsonObj
        imgSrc = re.compile('og:image" content="(.+?)"').findall(html)
        if(len(imgSrc) == 0):
            imgSrc = re.compile('/jpeg" href="(.+?)"').findall(html)
        dm_low = re.compile('"sdURL":"(.+?)"').findall(newseqeunce)
        dm_high = re.compile('"hqURL":"(.+?)"').findall(newseqeunce)
        
        video_info.set_video_image(imgSrc[0])
        video_info.set_video_stopped(False)
        
        if(len(dm_high) == 0 and len(dm_low) == 1):
            video_info.add_video_link(VIDEO_QUAL_SD, dm_low[0])
        elif(len(dm_low) == 0 and len(dm_high) == 1):
            video_info.add_video_link(VIDEO_QUAL_HD_720, dm_high[0])
        else:
            video_info.add_video_link(VIDEO_QUAL_SD, dm_low[0])
            video_info.add_video_link(VIDEO_QUAL_HD_720, dm_high[0])
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #6
0
def returnVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link_info = 'http://www.mediaplaybox'+video_id
        video_link_info = video_link_info.replace('/:81/','/').replace('mediaplaybox:81','mediaplaybox.com') + '.mp4'
        video_link = video_link_info.replace('_ipod.mp4', '.flv')
        hd_video_link = video_link.replace('_ipod.mp4', '_hd.mp4')
        video_info.set_video_stopped(False)
        video_info.set_video_name("Media PlayBox Video")
        try:
            response = HttpUtils.HttpClient().getResponse(url=hd_video_link)
            if response.status < 400:
                video_info.add_video_link(VIDEO_QUAL_HD_720, hd_video_link, addUserAgent=False)
        except Exception,e:
            print 'No HD link'
        video_info.add_video_link(VIDEO_QUAL_SD, video_link, addUserAgent=False)
Пример #7
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.divxstage.eu/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html):
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        HttpUtils.HttpClient().disableCookies()
        fileKey = re.compile('flashvars.filekey="(.+?)";').findall(html)[0]
        video_info_link = 'http://www.divxstage.eu/api/player.api.php?file=' + video_id + '&key=' + fileKey
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        video_link = re.compile('url=(.+?)&').findall(html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except Exception, e:
        logging.exception(e)
        video_info.set_video_stopped(True)
Пример #8
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.vidxden.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video bandwidth is expensive. We appreciate Your patience!', html):
            data = {'method_free': 'Continue to Video', 'op' : 'download1', 'usr_login' : '', 'id':str(video_id)}
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link, params=data)
        HttpUtils.HttpClient().disableCookies()
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(video_info_link)[0]
        
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #9
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://cdn.playwire.com/' + str(video_id) + '.xml'
        soup = BeautifulStoneSoup(HttpUtils.HttpClient().getHtmlContent(url=video_link), convertEntities=BeautifulStoneSoup.XML_ENTITIES)
        cfg = soup.find("config")
        img_link = cfg.findNext("poster").string
        video_link = cfg.findNext("src").string
        
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name("PLAYWIRE Video")
        if re.search(r'\Artmp',video_link):
            video_info.add_video_link(VIDEO_QUAL_HD_720, video_link, addUserAgent=False)
        else:
            video_info.add_video_link(VIDEO_QUAL_HD_720, video_link, addUserAgent=True)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #10
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        html = HttpUtils.HttpClient().getHtmlContent(url="https://docs.google.com/file/" + str(video_id) + "?pli=1")
        html = html.decode("utf8")
        title = re.compile("'title': '(.+?)'").findall(html)[0]
        video_info.set_video_name(title)
        stream_map = re.compile('fmt_stream_map":"(.+?)"').findall(html)[0].replace("\/", "/")
        formatArray = stream_map.split(",")
        for formatContent in formatArray:
            formatContentInfo = formatContent.split("|")
            qual = formatContentInfo[0]
            url = (formatContentInfo[1]).decode("unicode-escape")
            if qual == "13":  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif qual == "17":  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif qual == "36":  # 320x240
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif qual == "5":  # 400\\327226
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif qual == "34":  # 480x360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "6":  # 640\\327360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "35":  # 854\\327480 HD
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "18":  # 480x360 MP4
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "22":  # 1280x720 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif qual == "37":  # 1920x1080 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif qual == "38" and video_info.get_video_link(VIDEO_QUAL_HD_1080) is None:  # 4096\\3272304 EPIC MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif qual == "43" and video_info.get_video_link(VIDEO_QUAL_SD) is None:  # 360 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "44":  # 480 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif qual == "45" and video_info.get_video_link(VIDEO_QUAL_HD_720) is None:  # 720 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif qual == "46" and video_info.get_video_link(VIDEO_QUAL_HD_1080) is None:  # 1080 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif qual == "120" and video_info.get_video_link(VIDEO_QUAL_HD_720) is None:  # New video qual
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
                # 3D streams - MP4
                # 240p -> 83
                # 360p -> 82
                # 520p -> 85
                # 720p -> 84
                # 3D streams - WebM
                # 360p -> 100
                # 360p -> 101
                # 720p -> 102
            else:  # unknown quality
                video_info.add_video_link(VIDEO_QUAL_SD, url)

            video_info.set_video_stopped(False)
    except Exception, e:
        logging.exception(e)
        video_info.set_video_stopped(True)
Пример #11
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://embed.tune.pk/play/' + str(video_id) + '?autoplay=no'
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        image = re.compile("preview_img = '(.+?)';").findall(html)
        if image is not None and len(image) == 1:
            video_info.set_video_image(str(image[0]))
        html = html.replace('\n\r', '').replace('\r', '').replace('\n', '')
        sources = re.compile("{(.+?)}").findall(re.compile("sources:(.+?)]").findall(html)[0])
        for source in sources:
            video_link = str(re.compile('file[: ]*"(.+?)"').findall(source)[0])
            Logger.logDebug(video_link)
            label_text = re.compile('label[: ]*"(.+?)"').findall(source)
            if label_text is not None and len(label_text) == 1:
                label = str(label_text[0])
                Logger.logDebug(label)
                if label == '240p':
                    video_info.add_video_link(VIDEO_QUAL_LOW, video_link)
                elif label == '360p' and video_info.get_video_link(VIDEO_QUAL_SD) is None:
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)
                elif label == '480p' or label == 'SD':
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)
                elif label == '720p' or label == 'HD':
                    video_info.add_video_link(VIDEO_QUAL_HD_720, video_link)
                elif label == '1080p':
                    video_info.add_video_link(VIDEO_QUAL_HD_1080, video_link)
                else:
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)
                    
            else:
                video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #12
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://embed.tune.pk/play/' + str(
            video_id) + '?autoplay=no'
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        image = re.compile("preview_img = '(.+?)';").findall(html)
        if image is not None and len(image) == 1:
            video_info.set_video_image(str(image[0]))
        html = html.replace('\n\r', '').replace('\r', '').replace('\n', '')
        sources = re.compile("{(.+?)}").findall(
            re.compile("sources:(.+?)]").findall(html)[0])
        for source in sources:
            video_link = str(re.compile('file[: ]*"(.+?)"').findall(source)[0])
            Logger.logDebug(video_link)
            label_text = re.compile('label[: ]*"(.+?)"').findall(source)
            if label_text is not None and len(label_text) == 1:
                label = str(label_text[0])
                Logger.logDebug(label)
                if label == '240p':
                    video_info.add_video_link(VIDEO_QUAL_LOW, video_link)
                elif label == '360p' and video_info.get_video_link(
                        VIDEO_QUAL_SD) is None:
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)
                elif label == '480p' or label == 'SD':
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)
                elif label == '720p' or label == 'HD':
                    video_info.add_video_link(VIDEO_QUAL_HD_720, video_link)
                elif label == '1080p':
                    video_info.add_video_link(VIDEO_QUAL_HD_1080, video_link)
                else:
                    video_info.add_video_link(VIDEO_QUAL_SD, video_link)

            else:
                video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)

    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #13
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        
        video_info_link = 'http://www.facebook.com/video/video.php?v=' + str(video_id)
        html = urllib.unquote_plus(HttpUtils.HttpClient().getHtmlContent(url=video_info_link).replace('\u0025', '%'))

        video_title = re.compile('addVariable\("video_title"\, "(.+?)"').findall(html)[0]
        img_link = re.compile('addVariable\("thumb_url"\, "(.+?)"').findall(html)[0]
        high_video_link = re.compile('addVariable\("highqual_src"\, "(.+?)"').findall(html)
        low_video_link = re.compile('addVariable\("lowqual_src"\, "(.+?)"').findall(html)
        video_link = re.compile('addVariable\("video_src"\, "(.+?)"').findall(html)
        if len(high_video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_HD_720, high_video_link[0])
        if len(low_video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_SD, low_video_link[0])
        if len(video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_SD, video_link[0])

        video_info.set_video_stopped(False)
        video_info.set_video_name(video_title)
        video_info.set_video_image(img_link)
    except:
        raise
        video_info.set_video_stopped(True)
    return video_info
Пример #14
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.zshare.net/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        match = re.compile('<iframe src="http://www.zshare.net/videoplayer/player.php(.+?)"').findall(html)
        html = HttpUtils.HttpClient().getHtmlContent(url=('http://www.zshare.net/videoplayer/player.php' + match[0].replace(' ', '%20')))
        video_link = re.compile('file: "(.+?)"').findall(html)[0].replace(' ', '%20')
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #15
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        
        video_link = 'http://www.vioku.com/flvideo/' + video_id
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #16
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://my-entertainment.biz/' + str(video_id)
        print video_link
        HttpUtils.HttpClient().enableCookies()
        HttpUtils.HttpClient().getHtmlContent(url='http://my-entertainment.biz/forum/content.php')
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        print html
        match = re.compile("file=(.+?)&&").findall(html)
        video_link = urllib.unquote(match[0])
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #17
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info.set_video_image('http://i.ytimg.com/vi/' + video_id +
                                   '/default.jpg')
        html = HttpUtils.HttpClient().getHtmlContent(
            url='http://www.youtube.com/get_video_info?video_id=' + video_id +
            '&asv=3&el=detailpage&hl=en_US')
        stream_map = None
        html = html.decode('utf8')
        html = html.replace('\n', '')
        html = html.replace('\r', '')
        html = html + '&'
        title = urllib.unquote_plus(
            re.compile('&title=(.+?)&').findall(html)[0]).replace(
                '/\+/g', ' ')
        print title
        if re.search('status=fail', html):
            video_info.set_video_stopped(True)
            return video_info

        stream_info = re.compile('url_encoded_fmt_stream_map=(.+?)&').findall(
            html)
        stream_map = ''
        if (len(stream_info) == 0):
            stream_map = re.compile('fmt_stream_map": "(.+?)"').findall(
                html)[0].replace("\\/", "/")
        else:
            stream_map = stream_info[0]

        if stream_map == None:
            video_info.set_video_stopped(True)
            return video_info

        stream_map = urllib.unquote_plus(stream_map)

        formatArray = stream_map.split(',')
        for formatContent in formatArray:
            if formatContent == '':
                continue
            formatUrl = ""
            try:
                formatUrl = urllib.unquote(
                    re.compile("url=([^&]+)").findall(formatContent)
                    [0]) + "&title=" + urllib.quote_plus(title)
            except:
                print "Unexpected error"
            if re.search("rtmpe", stream_map):
                try:
                    conn = urllib.unquote(
                        re.compile("conn=([^&]+)").findall(formatContent)[0])
                    host = re.compile("rtmpe:\/\/([^\/]+)").findall(conn)[0]
                    stream = re.compile("stream=([^&]+)").findall(
                        formatContent)[0]
                    path = 'videoplayback'

                    formatUrl = "-r %22rtmpe:\/\/" + host + "\/" + path + "%22 -V -a %22" + path + "%22 -f %22WIN 11,3,300,268%22 -W %22http:\/\/s.ytimg.com\/yt\/swfbin\/watch_as3-vfl7aCF1A.swf%22 -p %22http:\/\/www.youtube.com\/watch?v=" + video_id + "%22 -y %22" + urllib.unquote(
                        stream) + "%22"
                except:
                    print "Unexpected error"

            if (formatUrl[0:4] == "http" or formatUrl[0:2] == "-r"):
                formatQual = re.compile("itag=([^&]+)").findall(
                    formatContent)[0]
                if not re.search("signature=", formatUrl):
                    formatUrl += "&signature=" + re.compile(
                        "sig=([^&]+)").findall(formatContent)[0]

            qual = formatQual
            url = formatUrl
            if (qual == '13'):  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '17'):  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '36'):  # 320x240
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '5'):  # 400\\327226
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '34'):  # 480x360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '6'):  # 640\\327360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '35'):  # 854\\327480 HD
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '18'):  # 480x360 MP4
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '22'):  # 1280x720 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif (qual == '37'):  # 1920x1080 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '38'
                  and video_info.get_video_link(VIDEO_QUAL_HD_1080) is
                  None):  # 4096\\3272304 EPIC MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '43' and video_info.get_video_link(VIDEO_QUAL_SD) is
                  None):  # 360 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '44'):  # 480 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '45' and video_info.get_video_link(VIDEO_QUAL_HD_720)
                  is None):  # 720 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif (qual == '46'
                  and video_info.get_video_link(VIDEO_QUAL_HD_1080) is
                  None):  # 1080 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '120'
                  and video_info.get_video_link(VIDEO_QUAL_HD_720) is
                  None):  # New video qual
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
                # 3D streams - MP4
                # 240p -> 83
                # 360p -> 82
                # 520p -> 85
                # 720p -> 84
                # 3D streams - WebM
                # 360p -> 100
                # 360p -> 101
                # 720p -> 102
            else:  # unknown quality
                video_info.add_video_link(VIDEO_QUAL_SD, url)

            video_info.set_video_stopped(False)
    except Exception, e:
        logging.exception(e)
        video_info.set_video_stopped(True)
Пример #18
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        
        HttpUtils.HttpClient().enableCookies()
        video_info.set_video_image('http://i.ytimg.com/vi/' + video_id + '/default.jpg')
        html = HttpUtils.HttpClient().getHtmlContent(url='http://www.youtube.com/get_video_info?video_id=' + video_id + '&asv=3&el=detailpage&hl=en_US')
        stream_map = None
        
        html = html.decode('utf8')
        html = html.replace('\n', '')
        html = html.replace('\r', '')
        html = unicode(html + '&').encode('utf-8')
        if re.search('status=fail', html):
            # XBMCInterfaceUtils.displayDialogMessage('Video info retrieval failed', 'Reason: ' + ((re.compile('reason\=(.+?)\.').findall(html))[0]).replace('+', ' ') + '.')
            Logger.logInfo('YouTube video is removed for Id = ' + video_id + ' reason = ' + html)
            video_info.set_video_stopped(True)
            return video_info
        
        title = urllib.unquote_plus(re.compile('title=(.+?)&').findall(html)[0]).replace('/\+/g', ' ')
        video_info.set_video_name(title)
        stream_info = None
        if not re.search('url_encoded_fmt_stream_map=&', html):
            stream_info = re.compile('url_encoded_fmt_stream_map=(.+?)&').findall(html)
        stream_map = None
        if (stream_info is None or len(stream_info) == 0) and re.search('fmt_stream_map": "', html):
            stream_map = re.compile('fmt_stream_map": "(.+?)"').findall(html)[0].replace("\\/", "/")
        elif stream_info is not None:
            stream_map = stream_info[0]
            
        if stream_map is None:
            params = HttpUtils.getUrlParams(html)
            Logger.logDebug('ENTERING live video scenario...')
            for key in params:
                Logger.logDebug(key + " : " + urllib.unquote_plus(params[key]))
            hlsvp = urllib.unquote_plus(params['hlsvp'])
            playlistItems = HttpUtils.HttpClient().getHtmlContent(url=hlsvp).splitlines()
            qualityIdentified = None
            for item in playlistItems:
                Logger.logDebug(item)
                if item.startswith('#EXT-X-STREAM-INF'):
                    if item.endswith('1280x720'):
                        qualityIdentified = VIDEO_QUAL_HD_720
                    elif item.endswith('1080'):
                        qualityIdentified = VIDEO_QUAL_HD_1080
                    elif item.endswith('854x480'):
                        qualityIdentified = VIDEO_QUAL_SD
                    elif item.endswith('640x360'):
                        qualityIdentified = VIDEO_QUAL_LOW
                elif item.startswith('http') and qualityIdentified is not None:
                    videoUrl = HttpUtils.HttpClient().addHttpCookiesToUrl(item, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id})
                    video_info.add_video_link(qualityIdentified, videoUrl)
                    qualityIdentified = None
            video_info.set_video_stopped(False)
            return video_info
        
        stream_map = urllib.unquote_plus(stream_map)
        Logger.logDebug(stream_map)
        formatArray = stream_map.split(',')
        streams = {}
        for formatContent in formatArray:
            if formatContent == '':
                continue
            formatUrl = ''
            try:
                formatUrl = urllib.unquote(re.compile("url=([^&]+)").findall(formatContent)[0]) + "&title=" + urllib.quote_plus(title)   
            except Exception, e:
                Logger.logFatal(e)     
            if re.search("rtmpe", stream_map):
                try:
                    conn = urllib.unquote(re.compile("conn=([^&]+)").findall(formatContent)[0]);
                    host = re.compile("rtmpe:\/\/([^\/]+)").findall(conn)[0];
                    stream = re.compile("stream=([^&]+)").findall(formatContent)[0];
                    path = 'videoplayback';
                    
                    formatUrl = "-r %22rtmpe:\/\/" + host + "\/" + path + "%22 -V -a %22" + path + "%22 -f %22WIN 11,3,300,268%22 -W %22http:\/\/s.ytimg.com\/yt\/swfbin\/watch_as3-vfl7aCF1A.swf%22 -p %22http:\/\/www.youtube.com\/watch?v=" + video_id + "%22 -y %22" + urllib.unquote(stream) + "%22"
                except Exception, e:
                    Logger.logFatal(e)
            if formatUrl == '':
                continue
            Logger.logDebug('************************')
            Logger.logDebug(formatContent)
            formatQual = ''
            if(formatUrl[0: 4] == "http" or formatUrl[0: 2] == "-r"):
                formatQual = re.compile("itag=([^&]+)").findall(formatContent)[0]
                if not re.search("signature=", formatUrl):
                    sig = re.compile("sig=([^&]+)").findall(formatContent)
                    if sig is not None and len(sig) == 1:
                        formatUrl += "&signature=" + sig[0]
                    else:
                        sig = re.compile("s=([^&]+)").findall(formatContent)
                        if sig is not None and len(sig) == 1:
                            formatUrl += "&signature=" + parseSignature(sig[0])
        
            qual = formatQual
            url = HttpUtils.HttpClient().addHttpCookiesToUrl(formatUrl, addHeaders=False,addCookies=False, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id})
            streams[int(qual)] = url
Пример #19
0
def retrieveVideoInfo(videoUrl):
    try:
        xbmcaddon.Addon('plugin.video.vevo')
    except:
        dialog = xbmcgui.Dialog()
        dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] VEVO add-on', '',
                  'Please install VEVO add-on created by BlueCop!',
                  'Available at http://code.google.com/p/bluecop-xbmc-repo/')
        raise
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    addon_url = 'plugin://plugin.video.vevo/?'
    vevo_id = videoUrl.split('/')[-1]
    if videoUrl.startswith('playlist'):
        url = urllib.quote_plus(
            'http://api.vevo.com/mobile/v2/playlist/%s.json?' % vevo_id)
        addon_url += 'url=%s' % url
        addon_url += '&mode=playPlaylist'
        addon_url += '&duration=210'
        addon_url += '&page=1'
        video_info.add_video_link(XBMC_EXECUTE_PLUGIN,
                                  addon_url,
                                  addUserAgent=False,
                                  addReferer=False)
        video_info.set_video_image('')
        video_info.set_video_name(' ')
    else:
        url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s&extended=true' % vevo_id
        video = json.loads(
            HttpUtils.HttpClient().getHtmlContent(url=url))['video']
        title = ''
        try:
            title = video['title'].encode('utf-8')
        except:
            title = ''
        video_image = video['imageUrl']
        if len(video['featuredArtists']) > 0:
            feats = ''
            for featuredartist in video['featuredArtists']:
                # featuredartist_image = featuredartist['image_url']
                featuredartist_name = featuredartist['artistName'].encode(
                    'utf-8')
                feats += featuredartist_name + ', '
            feats = feats[:-2]
            title += ' (ft. ' + feats + ')'

        addon_url += 'url=%s' % vevo_id
        addon_url += '&mode=playVideo'
        addon_url += '&duration=210'
        video_info.add_video_link(VIDEO_QUAL_SD,
                                  addon_url,
                                  addUserAgent=False,
                                  addReferer=False)
        video_info.set_video_image(video_image)
        video_info.set_video_name(title)

    Logger.logDebug(addon_url)
    video_info.set_video_stopped(False)
    return video_info
Пример #20
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://videos.stvflicks.com/' + str(video_id) + '.mp4'
        print video_link
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #21
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:

        video_url = 'https://www.youtube.com/watch?v=' + video_id
        yd_video_info = YDStreamExtractor.getVideoInfo(video_url, quality=1)
        if yd_video_info is not None:
            video_info.set_video_name(yd_video_info.title)
            video_info.set_video_image(yd_video_info.thumbnail)
            video_info.add_video_link(VIDEO_QUAL_HD_720,
                                      yd_video_info.streamURL())
            video_info.set_video_stopped(False)
        else:
            video_info.set_video_stopped(True)

    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #22
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.divxstage.eu/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html):
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        HttpUtils.HttpClient().disableCookies()
        
        video_link = re.compile('<param name="src" value="(.+?)"').findall(html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #23
0
def retrieveVideoInfo(videoUrl):
    try: 
        xbmcaddon.Addon('plugin.video.vevo')
    except: 
        dialog = xbmcgui.Dialog()
        dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] VEVO add-on', '', 'Please install VEVO add-on created by BlueCop!', 'Available at http://code.google.com/p/bluecop-xbmc-repo/')
        raise
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    addon_url = 'plugin://plugin.video.vevo/?'
    vevo_id = videoUrl.split('/')[-1]
    if videoUrl.startswith('playlist'):
        url = urllib.quote_plus('http://api.vevo.com/mobile/v2/playlist/%s.json?' % vevo_id)
        addon_url += 'url=%s' % url
        addon_url += '&mode=playPlaylist'
        addon_url += '&duration=210'
        addon_url += '&page=1'
        video_info.add_video_link(XBMC_EXECUTE_PLUGIN, addon_url, addUserAgent=False, addReferer=False)
        video_info.set_video_image('')
        video_info.set_video_name(' ')
    else:
        url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s&extended=true' % vevo_id
        video = json.loads(HttpUtils.HttpClient().getHtmlContent(url=url))['video']
        title = ''
        try:title = video['title'].encode('utf-8')
        except: title = ''                  
        video_image = video['imageUrl']
        if len(video['featuredArtists']) > 0:
            feats = ''
            for featuredartist in video['featuredArtists']:
                # featuredartist_image = featuredartist['image_url']
                featuredartist_name = featuredartist['artistName'].encode('utf-8')
                feats += featuredartist_name + ', '
            feats = feats[:-2]
            title += ' (ft. ' + feats + ')'
                
        addon_url += 'url=%s' % vevo_id
        addon_url += '&mode=playVideo'
        addon_url += '&duration=210'
        video_info.add_video_link(VIDEO_QUAL_SD, addon_url, addUserAgent=False, addReferer=False)
        video_info.set_video_image(video_image)
        video_info.set_video_name(title)
    
    Logger.logDebug(addon_url)
    video_info.set_video_stopped(False)
    return video_info
Пример #24
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://videos.videopress.com/' + str(video_id) + '.mp4'
        print video_link
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #25
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://videobam.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        streams = re.compile('(low|high): \'(.+?)\'').findall(html)
        for streamType, streamUrl in streams:
            if streamType == 'low':
                video_info.add_video_link(VIDEO_QUAL_SD, streamUrl)
            elif streamType == 'high':
                video_info.add_video_link(VIDEO_QUAL_HD_720, streamUrl)
        video_info.set_video_stopped(False)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #26
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.hostingbulk.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
        
        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(video_info_link)[0]
        
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #27
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.zalaa.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        link = ''.join(html.splitlines()).replace('\'', '"')
        video_link = re.compile('s1.addVariable\("file","(.+?)"\);').findall(link)[0]
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #28
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://my-entertainment.biz/' + str(video_id)
        print video_link
        HttpUtils.HttpClient().enableCookies()
        HttpUtils.HttpClient().getHtmlContent(
            url='http://my-entertainment.biz/forum/content.php')
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        print html
        match = re.compile("file=(.+?)&&").findall(html)
        video_link = urllib.unquote(match[0])
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #29
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        HttpUtils.HttpClient().disableCookies()
        
        matchFullHD = re.compile('"stream_h264_hd1080_url":"(.+?)"', re.DOTALL).findall(html)
        matchHD = re.compile('"stream_h264_hd_url":"(.+?)"', re.DOTALL).findall(html)
        matchHQ = re.compile('"stream_h264_hq_url":"(.+?)"', re.DOTALL).findall(html)
        matchSD = re.compile('"stream_h264_url":"(.+?)"', re.DOTALL).findall(html)
        matchLD = re.compile('"stream_h264_ld_url":"(.+?)"', re.DOTALL).findall(html)
        dm_LD = None
        dm_SD = None
        dm_720 = None
        dm_1080 = None
        
        if matchFullHD:
            dm_1080 = urllib.unquote_plus(matchFullHD[0]).replace("\\", "")
        if matchHD:
            dm_720 = urllib.unquote_plus(matchHD[0]).replace("\\", "")
        if dm_720 is None and matchHQ:
            dm_720 = urllib.unquote_plus(matchHQ[0]).replace("\\", "")
        if matchSD:
            dm_SD = urllib.unquote_plus(matchSD[0]).replace("\\", "")
        if matchLD:
            dm_LD = urllib.unquote_plus(matchLD[0]).replace("\\", "")
        
        if dm_LD is not None:
            video_info.add_video_link(VIDEO_QUAL_LOW, dm_LD, addReferer=True, refererUrl=video_link)
        if dm_SD is not None:
            video_info.add_video_link(VIDEO_QUAL_SD, dm_SD, addReferer=True, refererUrl=video_link)
        if dm_720 is not None:
            video_info.add_video_link(VIDEO_QUAL_HD_720, dm_720, addReferer=True, refererUrl=video_link)
        if dm_1080 is not None:
            video_info.add_video_link(VIDEO_QUAL_HD_1080, dm_1080, addReferer=True, refererUrl=video_link)
        video_info.set_video_stopped(False)
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #30
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.videozer.com/player_control/settings.php?v=' + video_id + '&fv=v1.1.45'
        jsonObj = json.load(urllib.urlopen(video_info_link))
                
        key1 = jsonObj["cfg"]["environment"]["rkts"]
        key2 = jsonObj["cfg"]["login"]["pepper"]
        key3 = jsonObj["cfg"]["ads"]["lightbox2"]["time"]
        
        values = binascii.unhexlify(decrypt(jsonObj["cfg"]["login"]["spen"], jsonObj["cfg"]["login"]["salt"], 950569)).split(';')
        spn = HttpUtils.getUrlParams(values[0])
        outk = HttpUtils.getUrlParams(values[1])
        ikey = getikey(int(outk["ik"]))
        
        urlKey = ''
        for spnkey in spn:
            spnval = spn[spnkey]
            if spnval == '1':
                cypher = jsonObj["cfg"]["info"]["sece2"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, ln=256) + '&'
            if spnval == '2':
                cypher = jsonObj["cfg"]["ads"]["g_ads"]["url"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey) + '&'
            if spnval == '3':
                cypher = jsonObj["cfg"]["ads"]["g_ads"]["type"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, 26, 25431, 56989, 93, 32589, 784152) + '&'
            if spnval == '4':
                cypher = jsonObj["cfg"]["ads"]["g_ads"]["time"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, 82, 84669, 48779, 32, 65598, 115498) + '&'
            if spnval == '5':
                cypher = jsonObj["cfg"]["login"]["euno"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key2, ikey, 10, 12254, 95369, 39, 21544, 545555) + '&'
            if spnval == '6':
                cypher = jsonObj["cfg"]["login"]["sugar"]
                urlKey = urlKey + spnkey + '=' + decrypt(cypher, key3, ikey, 22, 66595, 17447, 52, 66852, 400595) + '&'
        
        urlKey = urlKey + "start=0"
        
        video_link = ""
        for videoStrm in jsonObj["cfg"]["quality"]:
            if videoStrm["d"]:
                video_link = str(base64.b64decode(videoStrm["u"]))
        if video_link == "":
            video_info.set_video_stopped(False)
            raise Exception("VIDEO_STOPPED")
        video_link = video_link + '&' + urlKey
        
        video_info.set_video_name(jsonObj["cfg"]["info"]["video"]["title"])
        video_info.set_video_image(jsonObj["cfg"]["environment"]["thumbnail"])
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #31
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.megavideo.com/xml/videolink.php?v=' + str(
            video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        html = ''.join(html.splitlines()).replace('\t', '').replace('\'', '"')

        un = re.compile(' un="(.+?)"').findall(html)
        k1 = re.compile(' k1="(.+?)"').findall(html)
        k2 = re.compile(' k2="(.+?)"').findall(html)
        hashresult = decrypt(un[0], k1[0], k2[0])

        s = re.compile(' s="(.+?)"').findall(html)

        title = re.compile(' title="(.+?)"').findall(html)
        videoTitle = urllib.unquote_plus(title[0].replace('+', ' ').replace(
            '.', ' '))

        video_link = "http://www" + s[
            0] + ".megavideo.com/files/" + hashresult + "/" + videoTitle.replace(
                'www.apnajoy.com', '') + ".flv"
        video_info.set_video_stopped(False)
        video_info.set_video_name(videoTitle)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #32
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.vidpe.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        paramSet = re.compile(
            "return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(
            paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]),
            paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')

        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(
            video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(
            video_info_link)[0]

        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #33
0
def returnVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link_info = 'http://www.mediaplaybox' + video_id
        video_link_info = video_link_info.replace('/:81/', '/').replace(
            'mediaplaybox:81', 'mediaplaybox.com') + '.mp4'
        video_link = video_link_info.replace('_ipod.mp4', '.flv')
        hd_video_link = video_link.replace('_ipod.mp4', '_hd.mp4')
        video_info.set_video_stopped(False)
        video_info.set_video_name("Media PlayBox Video")
        try:
            response = HttpUtils.HttpClient().getResponse(url=hd_video_link)
            if response.status < 400:
                video_info.add_video_link(VIDEO_QUAL_HD_720,
                                          hd_video_link,
                                          addUserAgent=False)
        except Exception, e:
            print 'No HD link'
        video_info.add_video_link(VIDEO_QUAL_SD,
                                  video_link,
                                  addUserAgent=False)
Пример #34
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        HttpUtils.HttpClient().disableCookies()
        sequence = re.compile('"sequence":"(.+?)"').findall(html)
        if(len(sequence) == 0):
            sequence = re.compile('"sequence",  "(.+?)"').findall(html)
            newseqeunce = urllib.unquote(sequence[0]).decode('utf8').replace('\\/', '/')
            imgSrc = re.compile('og:image" content="(.+?)"').findall(html)
            if(len(imgSrc) == 0):
                imgSrc = re.compile('/jpeg" href="(.+?)"').findall(html)
            dm_low = re.compile('"sdURL":"(.+?)"').findall(newseqeunce)
            dm_high = re.compile('"hqURL":"(.+?)"').findall(newseqeunce)
            
            video_info.set_video_image(imgSrc[0])
            video_info.set_video_stopped(False)
            
            if(len(dm_high) == 0 and len(dm_low) == 1):
                video_info.add_video_link(VIDEO_QUAL_SD, dm_low[0])
            elif(len(dm_low) == 0 and len(dm_high) == 1):
                video_info.add_video_link(VIDEO_QUAL_HD_720, dm_high[0])
            else:
                video_info.add_video_link(VIDEO_QUAL_SD, dm_low[0])
                video_info.add_video_link(VIDEO_QUAL_HD_720, dm_high[0])
        else:
            newseqeunce = urllib.unquote(sequence[0]).decode('utf8').replace('\\/', '/')
            jObj = json.loads(newseqeunce)
            for sequenceItem in jObj['sequence'][0]['layerList'][0]['sequenceList']:
                if sequenceItem['name'] == 'main':
                    for layerItem in sequenceItem['layerList']:
                        if layerItem['name'] == 'video' and layerItem['type'] == 'VideoFrame':
                            params = layerItem['param']
                            if params.has_key('sdURL'):
                                dm_low = params['sdURL']
                                video_info.add_video_link(VIDEO_QUAL_SD, dm_low)
                            if params.has_key('hqURL'):
                                dm_high = params['hqURL']
                                video_info.add_video_link(VIDEO_QUAL_HD_720, dm_high)
                            video_info.set_video_stopped(False)
                        elif layerItem['name'] == 'relatedBackground' and layerItem['type'] == 'Background':
                            params = layerItem['param']
                            video_info.set_video_image(params['imageURL'])
    except Exception, e:
        logging.exception(e)
        video_info.set_video_stopped(True)
Пример #35
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.mediaplaybox.com/mobile?vinf=' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(
            url=video_link, headers=HttpUtils.IPAD_HEADERS)
        video_file_info = re.compile(
            'href="http://www.mediaplaybox.com/media/files_flv/(.+?)"'
        ).findall(html)
        if (len(video_file_info) == 0):
            video_file_info = re.compile(
                'href="http://www.mediaplaybox.com:81/media/files_flv/(.+?)"'
            ).findall(html)
        video_file = video_file_info[0]
        img_file_info = re.compile(
            'src="http://www.mediaplaybox.com/media/files_thumbnail/(.+?)"'
        ).findall(html)
        if (len(img_file_info) == 0):
            img_file_info = re.compile(
                'src="http://www.mediaplaybox.com/media/files_thumbnail/(.+?)"'
            ).findall(html)[0]
        img_file = img_file_info[0]
        video_link = 'http://www.mediaplaybox.com/media/files_flv/' + video_file.replace(
            '_ipod.mp4', '.flv')
        hd_video_link = 'http://www.mediaplaybox.com/media/files_flv/' + video_file.replace(
            '_ipod.mp4', '_hd.mp4')
        img_link = 'http://www.mediaplaybox.com/media/files_thumbnail/' + img_file
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name("Media PlayBox Video")
        try:
            response = HttpUtils.HttpClient().getResponse(url=hd_video_link)
            if response.status < 400:
                video_info.add_video_link(VIDEO_QUAL_HD_720,
                                          hd_video_link,
                                          addUserAgent=False)
        except Exception, e:
            print 'No HD link'
        video_info.add_video_link(VIDEO_QUAL_SD,
                                  video_link,
                                  addUserAgent=False)
Пример #36
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:

        html = HttpUtils.HttpClient().getHtmlContent(url='http://vimeo.com/' + str(video_id))
        referrerObj = re.compile('"timestamp":(.+?),"signature":"(.+?)"').findall(html)[0]
        req_sig_exp = referrerObj[0]
        req_sig = referrerObj[1]
        
        img_link = re.compile('itemprop="thumbnailUrl" content="(.+?)"').findall(html)[0]
        video_title = re.compile('"title":"(.+?)"').findall(html)[0]
        
        qual = 'sd'
        video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
        if(re.search('"hd":1', html)):
            qual = 'hd'
            video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual)
            video_info.add_video_link(VIDEO_QUAL_HD_720, video_link)
            
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name(video_title)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #37
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&permalink=' + str(
            video_id) + '&apiKey=' + API_KEY
        soup = BeautifulStoneSoup(
            HttpUtils.HttpClient().getHtmlContent(url=video_info_link),
            convertEntities=BeautifulStoneSoup.XML_ENTITIES)

        videoObj = soup.findChild(name='video')
        video_link = HttpUtils.getRedirectedUrl(str(videoObj['ipodurl']))
        img_link = str(videoObj['highresimage'])
        video_title = str(videoObj['title'])

        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name(video_title)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #38
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.vimeo.com/moogaloop/load/clip:' + str(
            video_id)
        soup = BeautifulStoneSoup(
            HttpUtils.HttpClient().getHtmlContent(url=video_info_link),
            convertEntities=BeautifulStoneSoup.XML_ENTITIES)

        referrerObj = soup.findChild(name='referrer')
        req_sig = referrerObj.findChild(name='request_signature').getText()
        req_sig_exp = referrerObj.findChild(
            name='request_signature_expires').getText()

        videoObj = soup.findChild(name='video')
        img_link = videoObj.findChild(name='thumbnail').getText()
        video_title = videoObj.findChild(name='caption').getText()

        qual = 'sd'
        video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (
            video_id, req_sig, req_sig_exp, qual)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

        if (videoObj.findChild(name='ishd').getText() == '1'):
            qual = 'hd'
            video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (
                video_id, req_sig, req_sig_exp, qual)
            video_info.add_video_link(VIDEO_QUAL_HD_720, video_link)

        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name(video_title)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #39
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://movzap.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        if len(paramSet) > 0:
            video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
            
            img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link)
            if len(img_data) == 1:
                video_info.set_video_image(img_data[0])
            video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0]
        else:
            video_link = re.compile("'file': '(.+?)'").findall(html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Пример #40
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.divxstage.eu/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(
                r'Video hosting is expensive. We need you to prove you\'re human.',
                html):
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        HttpUtils.HttpClient().disableCookies()

        video_link = re.compile('<param name="src" value="(.+?)"').findall(
            html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #41
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.videoweed.es/file/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html):
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        domainStr = re.compile('flashvars.domain="(.+?)"').findall(html)[0]
        fileStr = re.compile('flashvars.file="(.+?)"').findall(html)[0]
        filekey = re.compile('flashvars.filekey="(.+?)"').findall(html)
        filekeyStr = None
        if len(filekey) == 0:
            filekeyStr = re.compile('flashvars.filekey=(.+?);').findall(html)[0]
            filekeyStr = re.compile('var ' + filekeyStr + '="(.+?)"').findall(html)[0]
        else:
            filekeyStr = filekey[0]
        video_info_link = domainStr + '/api/player.api.php?user=undefined&pass=undefined&codes=1&file=' + fileStr + '&key=' + filekeyStr
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        video_link = re.compile(r'url=(.+?)&').findall(html)[0]
        HttpUtils.HttpClient().disableCookies()
        
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except: 
        video_info.set_video_stopped(True)
    return video_info
def retrieveVideoInfo(videoUrl):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    try:
        sources = []
        hosted_media = urlresolver.HostedMediaFile(url=videoUrl)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)
        stream_url = ''
        if source: 
            stream_url = source.resolve()
    
        video_info.set_video_stopped(False)
        video_info.set_video_image('')
        video_info.set_video_name(' ')
        video_info.add_video_link(VIDEO_QUAL_SD, stream_url)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #43
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.megavideo.com/xml/videolink.php?v=' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        html = ''.join(html.splitlines()).replace('\t', '').replace('\'', '"')
        
        un = re.compile(' un="(.+?)"').findall(html)
        k1 = re.compile(' k1="(.+?)"').findall(html)
        k2 = re.compile(' k2="(.+?)"').findall(html)
        hashresult = decrypt(un[0], k1[0], k2[0])
        
        s = re.compile(' s="(.+?)"').findall(html)
        
        title = re.compile(' title="(.+?)"').findall(html)
        videoTitle = urllib.unquote_plus(title[0].replace('+', ' ').replace('.', ' '))
        
        video_link = "http://www" + s[0] + ".megavideo.com/files/" + hashresult + "/" + videoTitle.replace('www.apnajoy.com', '') + ".flv";
        video_info.set_video_stopped(False)
        video_info.set_video_name(videoTitle)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #44
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.mediaplaybox.com/mobile?vinf=' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link, headers=HttpUtils.IPAD_HEADERS)
        video_file_info = re.compile('href="http://www.mediaplaybox.com/media/files_flv/(.+?)"').findall(html)
        if(len(video_file_info) == 0):
            video_file_info = re.compile('href="http://www.mediaplaybox.com:81/media/files_flv/(.+?)"').findall(html)
        video_file = video_file_info[0]
        img_file_info = re.compile('src="http://www.mediaplaybox.com/media/files_thumbnail/(.+?)"').findall(html)
        if(len(img_file_info) == 0):
            img_file_info = re.compile('src="http://www.mediaplaybox.com/media/files_thumbnail/(.+?)"').findall(html)[0]
        img_file = img_file_info[0]
        video_link = 'http://www.mediaplaybox.com/media/files_flv/' + video_file.replace('_ipod.mp4', '.flv')
        hd_video_link = 'http://www.mediaplaybox.com/media/files_flv/' + video_file.replace('_ipod.mp4', '_hd.mp4')
        img_link = 'http://www.mediaplaybox.com/media/files_thumbnail/' + img_file
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name("Media PlayBox Video")
        try:
            response = HttpUtils.HttpClient().getResponse(url=hd_video_link)
            if response.status < 400:
                video_info.add_video_link(VIDEO_QUAL_HD_720, hd_video_link, addUserAgent=False)
        except Exception,e:
            print 'No HD link'
        video_info.add_video_link(VIDEO_QUAL_SD, video_link, addUserAgent=False)
Пример #45
0
def retrieveVideoInfo(videoUrl):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    try:
        sources = []
        hosted_media = urlresolver.HostedMediaFile(url=videoUrl)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)
        stream_url = ''
        if source:
            stream_url = source.resolve()

        video_info.set_video_stopped(False)
        video_info.set_video_image('')
        video_info.set_video_name(' ')
        video_info.add_video_link(VIDEO_QUAL_SD, stream_url)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #46
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&permalink=' + str(video_id) + '&apiKey=' + API_KEY
        soup = BeautifulStoneSoup(HttpUtils.HttpClient().getHtmlContent(url=video_info_link), convertEntities=BeautifulStoneSoup.XML_ENTITIES)
        
        videoObj = soup.findChild(name='video')
        video_link = HttpUtils.getRedirectedUrl(str(videoObj['ipodurl']))
        img_link = str(videoObj['highresimage'])
        video_title = str(videoObj['title'])
        
        video_info.set_video_stopped(False)
        video_info.set_video_image(img_link)
        video_info.set_video_name(video_title)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #47
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.zalaa.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        link = ''.join(html.splitlines()).replace('\'', '"')
        video_link = re.compile('s1.addVariable\("file","(.+?)"\);').findall(
            link)[0]
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        video_info.set_video_stopped(False)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #48
0
def retrieveVideoInfo(video_id):
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_link = 'http://www.comedyportal.net/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_link)
        match = re.compile("id='pl'.+?data='(.+?)'").findall(html)
        html = HttpUtils.HttpClient().getHtmlContent(url=match[0].replace(' ', '%20'))
        video_link = re.compile("file : '(.+?)'").findall(html)[0].replace(' ', '%20')
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #49
0
def retrieveVideoInfo(videoUrl):
    try:
        xbmcaddon.Addon('plugin.video.iplayer')
    except:
        dialog = xbmcgui.Dialog()
        dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] BBC IPlayer v2 add-on',
                  '',
                  'Please install BBC IPlayer v2 add-on created by Hitcher!',
                  'Available at http://code.google.com/p/xbmc-iplayerv2/')
        raise
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    addon_url = 'plugin://plugin.video.iplayer/?'
    video_params = videoUrl.split('/')

    addon_url += 'pid=%s' % video_params[0]
    video_info.add_video_link(VIDEO_QUAL_SD,
                              addon_url,
                              addUserAgent=False,
                              addReferer=False)
    video_info.set_video_image(
        'http://www.bbc.co.uk/iplayer/images/episode/%s_512_288.jpg' %
        video_params[0])
    video_info.set_video_name(video_params[1].replace('_', ' '))

    Logger.logDebug(addon_url)
    video_info.set_video_stopped(False)
    return video_info
Пример #50
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.vidbux.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(
                r'Video bandwidth is expensive. We appreciate Your patience!',
                html):
            data = {
                'method_free': 'Continue to Video',
                'op': 'download1',
                'usr_login': '',
                'id': str(video_id)
            }
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link,
                                                         params=data)

        HttpUtils.HttpClient().disableCookies()
        paramSet = re.compile(
            "return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(
            paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]),
            paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')

        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(
            video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(
            video_info_link)[0]

        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Пример #51
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.movshare.net/video/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html):
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        video_info_link = re.compile('<embed type="video/divx" src="(.+?)"').findall(html)
        video_link = ''
        if len(video_info_link) == 0:
            domainStr = re.compile('flashvars.domain="(.+?)"').findall(html)[0]
            fileStr = re.compile('flashvars.file="(.+?)"').findall(html)[0]
            filekeyStr = re.compile('flashvars.filekey="(.+?)"').findall(html)[0]
            
            video_info_link = domainStr + '/api/player.api.php?user=undefined&pass=undefined&codes=1&file=' + fileStr + '&key=' + filekeyStr
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
            video_link = re.compile(r'url=(.+?)&').findall(html)[0]
        else:
            video_link = video_info_link[0]
            
        HttpUtils.HttpClient().disableCookies()
        
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
    except: 
        video_info.set_video_stopped(True)
    return video_info
Пример #52
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        html = HttpUtils.HttpClient().getHtmlContent(
            url='https://docs.google.com/file/' + str(video_id) + '?pli=1')
        html = html.decode('utf8')
        title = re.compile("'title': '(.+?)'").findall(html)[0]
        video_info.set_video_name(title)
        stream_map = re.compile('fmt_stream_map":"(.+?)"').findall(
            html)[0].replace("\/", "/")
        formatArray = stream_map.split(',')
        for formatContent in formatArray:
            formatContentInfo = formatContent.split('|')
            qual = formatContentInfo[0]
            url = (formatContentInfo[1]).decode('unicode-escape')
            if (qual == '13'):  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '17'):  # 176x144
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '36'):  # 320x240
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '5'):  # 400\\327226
                video_info.add_video_link(VIDEO_QUAL_LOW, url)
            elif (qual == '34'):  # 480x360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '6'):  # 640\\327360 FLV
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '35'):  # 854\\327480 HD
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '18'):  # 480x360 MP4
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '22'):  # 1280x720 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif (qual == '37'):  # 1920x1080 MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '38'
                  and video_info.get_video_link(VIDEO_QUAL_HD_1080) is
                  None):  # 4096\\3272304 EPIC MP4
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '43' and video_info.get_video_link(VIDEO_QUAL_SD) is
                  None):  # 360 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '44'):  # 480 WEBM
                video_info.add_video_link(VIDEO_QUAL_SD, url)
            elif (qual == '45' and video_info.get_video_link(VIDEO_QUAL_HD_720)
                  is None):  # 720 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
            elif (qual == '46'
                  and video_info.get_video_link(VIDEO_QUAL_HD_1080) is
                  None):  # 1080 WEBM
                video_info.add_video_link(VIDEO_QUAL_HD_1080, url)
            elif (qual == '120'
                  and video_info.get_video_link(VIDEO_QUAL_HD_720) is
                  None):  # New video qual
                video_info.add_video_link(VIDEO_QUAL_HD_720, url)
                # 3D streams - MP4
                # 240p -> 83
                # 360p -> 82
                # 520p -> 85
                # 720p -> 84
                # 3D streams - WebM
                # 360p -> 100
                # 360p -> 101
                # 720p -> 102
            else:  # unknown quality
                video_info.add_video_link(VIDEO_QUAL_SD, url)

            video_info.set_video_stopped(False)
    except Exception, e:
        logging.exception(e)
        video_info.set_video_stopped(True)
Пример #53
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:

        video_info_link = 'http://www.facebook.com/video/video.php?v=' + str(
            video_id)
        html = urllib.unquote_plus(HttpUtils.HttpClient().getHtmlContent(
            url=video_info_link).replace('\u0025', '%'))

        video_title = re.compile(
            'addVariable\("video_title"\, "(.+?)"').findall(html)[0]
        img_link = re.compile('addVariable\("thumb_url"\, "(.+?)"').findall(
            html)[0]
        high_video_link = re.compile(
            'addVariable\("highqual_src"\, "(.+?)"').findall(html)
        low_video_link = re.compile(
            'addVariable\("lowqual_src"\, "(.+?)"').findall(html)
        video_link = re.compile('addVariable\("video_src"\, "(.+?)"').findall(
            html)
        if len(high_video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_HD_720, high_video_link[0])
        if len(low_video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_SD, low_video_link[0])
        if len(video_link) > 0:
            video_info.add_video_link(VIDEO_QUAL_SD, video_link[0])

        video_info.set_video_stopped(False)
        video_info.set_video_name(video_title)
        video_info.set_video_image(img_link)
    except:
        raise
        video_info.set_video_stopped(True)
    return video_info