Exemplo n.º 1
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://letwatch.us/embed-' + str(video_id) + '-620x496.html'
        logging.getLogger().debug('URL : ' + video_link)
        html = http.HttpClient().get_html_content(url=video_link)
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d*),(\d*),\'(.+?)\'").findall(html)
        video_info_link = None
        if len(paramSet) > 0:
            video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
        logging.getLogger().debug(video_info_link)
        img_link = re.compile("image\:'(.+?)'").findall(video_info_link)[0]                
        hd_video_link = re.compile("file\:'(.+?)',label\:'SD'").findall(video_info_link)
        if len(hd_video_link) > 0:
            video.add_stream_link(STREAM_QUAL_HD_720, hd_video_link[0])
        sd_video_link = re.compile("file\:'(.+?)',label\:'HD'").findall(video_info_link)
        if len(sd_video_link) > 0:
            video.add_stream_link(STREAM_QUAL_SD, sd_video_link[0])
        logging.getLogger().debug(video.get_streams())
        video.set_stopped(False)
        video.set_thumb_image(img_link)
        video.set_name("LetWatch Video")
    except:
        video.set_stopped(True)
    return video
Exemplo n.º 2
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        http.HttpClient().disable_cookies()

        player = re.compile(
            'document\.getElementById\(\'player\'\), (.+?)\);').findall(html)
        player_obj = json.loads(player[0])
        video_qual = player_obj['metadata']['qualities']
        print video_qual
        dm_LD = None
        if video_qual.has_key('380'):
            dm_LD = video_qual['380'][0]['url']
        dm_SD = None
        if video_qual.has_key('480'):
            dm_SD = video_qual['480'][0]['url']
        dm_720 = None
        if video_qual.has_key('720'):
            dm_720 = video_qual['720'][0]['url']
        dm_1080 = None
        if video_qual.has_key('1080'):
            dm_1080 = video_qual['1080'][0]['url']

        if dm_LD is not None:
            video.add_stream_link(STREAM_QUAL_LOW,
                                  dm_LD,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_SD is not None:
            video.add_stream_link(STREAM_QUAL_SD,
                                  dm_SD,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_720 is not None:
            video.add_stream_link(STREAM_QUAL_HD_720,
                                  dm_720,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_1080 is not None:
            video.add_stream_link(STREAM_QUAL_HD_1080,
                                  dm_1080,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if len(video.get_streams()) == 0:
            video.set_stopped(True)
        else:
            video.set_stopped(False)
    except Exception, e:
        logging.getLogger().error(e)
        video.set_stopped(True)
Exemplo n.º 3
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = "http://www.dailymotion.com/embed/video/" + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        http.HttpClient().disable_cookies()

        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.add_stream_link(STREAM_QUAL_LOW, dm_LD, addUserAgent=False, addReferer=False, refererUrl=video_link)
        if dm_SD is not None:
            video.add_stream_link(STREAM_QUAL_SD, dm_SD, addUserAgent=False, addReferer=False, refererUrl=video_link)
        if dm_720 is not None:
            video.add_stream_link(
                STREAM_QUAL_HD_720, dm_720, addUserAgent=False, addReferer=False, refererUrl=video_link
            )
        if dm_1080 is not None:
            video.add_stream_link(
                STREAM_QUAL_HD_1080, dm_1080, addUserAgent=False, addReferer=False, refererUrl=video_link
            )
        if len(video.get_streams()) == 0:
            video.set_stopped(True)
        else:
            video.set_stopped(False)
    except Exception, e:
        logging.getLogger().error(e)
        video.set_stopped(True)
Exemplo n.º 4
0
def retrieveVideoInfo(video_id):    
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://www.cloudy.ec/embed.php?id=' + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        video_key = re.compile('key\: "(.+?)"').findall(html)[0]
        video.set_stopped(False)
        video.set_thumb_image('')
        video.set_name("CloudEC Video")
        video_url = 'http://www.cloudy.ec/api/player.api.php?user=undefined&codes=1&file=' + video_id + '&pass=undefined&key=' + video_key
        html = http.HttpClient().get_html_content(url=video_url)
        video_link = re.compile('url=(.+?)&title=').findall(html)[0]
        video.add_stream_link(STREAM_QUAL_SD, urllib.unquote_plus(video_link))
        logging.getLogger().debug(video.get_streams())
    except:
        video.set_stopped(True)
    return video
Exemplo n.º 5
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        http.HttpClient().disable_cookies()
        
        player = re.compile('document\.getElementById\(\'player\'\), (.+?)\);').findall(html)
        player_obj = json.loads(player[0])
        video_qual = player_obj['metadata']['qualities']
        print video_qual
        dm_LD = None
        if video_qual.has_key('380'):
            dm_LD = video_qual['380'][0]['url']
        dm_SD = None
        if video_qual.has_key('480'):
            dm_SD = video_qual['480'][0]['url']
        dm_720 = None
        if video_qual.has_key('720'):
            dm_720 = video_qual['720'][0]['url']
        dm_1080 = None
        if video_qual.has_key('1080'):
            dm_1080 = video_qual['1080'][0]['url']
        
        if dm_LD is not None:
            video.add_stream_link(STREAM_QUAL_LOW, dm_LD, addUserAgent=False , addReferer=False, refererUrl=video_link)
        if dm_SD is not None:
            video.add_stream_link(STREAM_QUAL_SD, dm_SD, addUserAgent=False , addReferer=False, refererUrl=video_link)
        if dm_720 is not None:
            video.add_stream_link(STREAM_QUAL_HD_720, dm_720, addUserAgent=False , addReferer=False, refererUrl=video_link)
        if dm_1080 is not None:
            video.add_stream_link(STREAM_QUAL_HD_1080, dm_1080, addUserAgent=False , addReferer=False, refererUrl=video_link)
        if len(video.get_streams()) == 0:
            video.set_stopped(True)
        else:
            video.set_stopped(False)
    except Exception, e:
        logging.getLogger().error(e)
        video.set_stopped(True)
Exemplo n.º 6
0
        video_link = 'http://letwatch.us/embed-' + str(video_id) + '-620x496.html'
        logging.getLogger().debug('URL : ' + video_link)
        html = http.HttpClient().get_html_content(url=video_link)
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d*),(\d*),\'(.+?)\'").findall(html)
        video_info_link = None
        if len(paramSet) > 0:
            video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
        logging.getLogger().debug(video_info_link)
        img_link = re.compile("image\:'(.+?)'").findall(video_info_link)[0]                
        hd_video_link = re.compile("file\:'(.+?)',label\:'SD'").findall(video_info_link)
        if len(hd_video_link) > 0:
            video.add_stream_link(STREAM_QUAL_HD_720, hd_video_link[0])
        sd_video_link = re.compile("file\:'(.+?)',label\:'HD'").findall(video_info_link)
        if len(sd_video_link) > 0:
            video.add_stream_link(STREAM_QUAL_SD, sd_video_link[0])
        logging.getLogger().debug(video.get_streams())
        video.set_stopped(False)
        video.set_thumb_image(img_link)
        video.set_name("LetWatch Video")
=======
    # Old Method
    #import urlresolver
    #videoUrl =  'http://letwatch.us/embed-' + str(video_id) + '-595x430.html'
    #media = urlresolver.HostedMediaFile(url=videoUrl, title='')   

    #New method to get 720links
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)

    try:
Exemplo n.º 7
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        http.HttpClient().disable_cookies()

        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.add_stream_link(STREAM_QUAL_LOW,
                                  dm_LD,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_SD is not None:
            video.add_stream_link(STREAM_QUAL_SD,
                                  dm_SD,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_720 is not None:
            video.add_stream_link(STREAM_QUAL_HD_720,
                                  dm_720,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if dm_1080 is not None:
            video.add_stream_link(STREAM_QUAL_HD_1080,
                                  dm_1080,
                                  addUserAgent=False,
                                  addReferer=False,
                                  refererUrl=video_link)
        if len(video.get_streams()) == 0:
            video.set_stopped(True)
        else:
            video.set_stopped(False)
    except Exception, e:
        logging.getLogger().error(e)
        video.set_stopped(True)
Exemplo n.º 8
0
def retrieveVideoInfo(video_id):
    video = Video()
    video.set_video_host(getVideoHost())
    video.set_id(video_id)
    try:
        video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id)
        html = http.HttpClient().get_html_content(url=video_link)
        http.HttpClient().disable_cookies()

        matchHDLink = ''
        matchHQLink = ''
        matchSDLink = ''
        matchLDLink = ''

        matchHD = re.compile(
            '720\"\:\[\{\"type\"\:\"application\\\/x\-mpegURL\"\,\"url\"\:\"(.+?)\"\}\,\{\"type\"\:\"video\\\/mp4\"\,\"url\"\:\"(.+?)\"',
            re.DOTALL).findall(html)
        matchHQ = re.compile(
            '480\"\:\[\{\"type\"\:\"application\\\/x\-mpegURL\"\,\"url\"\:\"(.+?)\"\}\,\{\"type\"\:\"video\\\/mp4\"\,\"url\"\:\"(.+?)\"',
            re.DOTALL).findall(html)
        matchSD = re.compile(
            '380\"\:\[\{\"type\"\:\"application\\\/x\-mpegURL\"\,\"url\"\:\"(.+?)\"\}\,\{\"type\"\:\"video\\\/mp4\"\,\"url\"\:\"(.+?)\"',
            re.DOTALL).findall(html)
        matchLD = re.compile(
            '240\"\:\[\{\"type\"\:\"application\\\/x\-mpegURL\"\,\"url\"\:\"(.+?)\"\}\,\{\"type\"\:\"video\\\/mp4\"\,\"url\"\:\"(.+?)\"',
            re.DOTALL).findall(html)

        try:
            if matchHD[0][1]:
                matchHDLink = matchHD[0][1]
        except:
            print "No Dailymotion HD Link"

        try:
            if matchHQ[0][1]:
                matchHQLink = matchHQ[0][1]
        except:
            print "No Dailymotion HQ Link"

        try:
            if matchSD[0][1]:
                matchSDLink = matchSD[0][1]
        except:
            print "No Dailymotion SD Link"

        try:
            if matchLD[0][1]:
                matchLDLink = matchLD[0][1]
        except:
            print "No Dailymotion LD Link"

        matchHDLink = matchHDLink.replace('\/', '/')
        matchHQLink = matchHQLink.replace('\/', '/')
        matchSDLink = matchSDLink.replace('\/', '/')
        matchLDLink = matchLDLink.replace('\/', '/')

        dm_LD = None
        dm_SD = None
        dm_HQ = None
        dm_720 = None
        final_url = None

        if matchHDLink:
            dm_720 = urllib.unquote_plus(matchHDLink).replace("\\", "")
        if dm_720 is None and matchHQ:
            dm_720 = urllib.unquote_plus(matchHQLink).replace("\\", "")
        if matchSD:
            dm_SD = urllib.unquote_plus(matchSDLink).replace("\\", "")
        if matchLD:
            dm_LD = urllib.unquote_plus(matchLDLink).replace("\\", "")

        if final_url is None and dm_720 is not None:
            final_url = dm_720
        if final_url is None and dm_HQ is not None:
            final_url = dm_HQ
        if final_url is None and dm_SD is not None:
            final_url = dm_SD
        if final_url is None and dm_LD is not None:
            final_url = dm_LD

        video.add_stream_link(STREAM_QUAL_HD_1080,
                              final_url,
                              addUserAgent=False,
                              addReferer=False,
                              refererUrl=video_link)
        video.set_thumb_image(
            'http://fontslogo.com/wp-content/uploads/2013/02/Dailymotion-LOGO.jpg'
        )
        if len(video.get_streams()) == 0:
            video.set_stopped(True)
        else:
            video.set_stopped(False)
    except Exception, e:
        logging.getLogger().error(e)
        video.set_stopped(True)