예제 #1
0
def download(urlvideo):
    try:
        from YDStreamExtractor import getVideoInfo
        from YDStreamExtractor import handleDownload
        info = getVideoInfo(urlvideo, resolve_redirects=True)
        dlpath = plugin.get_setting('downloadpath')
        if not os.path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
    except:
        plugin.notify(urlvideo, "Download Failed")
예제 #2
0
def download(params):
    vurl = ''
    if params.video is not None:
        vurl = params.video
    else:
        return None
    try:
        from YDStreamExtractor import getVideoInfo
        from YDStreamExtractor import handleDownload
        info = getVideoInfo(vurl, resolve_redirects=True)
        dlpath = plugin.get_setting('downloadpath')
        if not path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
    except:
        showMessage(msg=vurl, header="Download Failed")
예제 #3
0
def download(vurl=None):
    if vurl is None:
        return []
    if vurl.find("%20") != -1 or vurl.find("+") != -1:
        vurl = Unquote(vurl)
    try:
        from YDStreamExtractor import getVideoInfo
        from YDStreamExtractor import handleDownload
        info = getVideoInfo(vurl, resolve_redirects=True)
        playurl = info.streamURL
        dlpath = plugin.get_setting('downloadPath')
        if not os.path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
        plugin.log.info(msg="** DOWNLOAD VIDEO AT {0} **".format(vurl))
        plugin.log.info(msg=playurl)
        plugin.log.info(msg=str(repr(info)))
    except:
        plugin.notify(vurl, "Download Failed")
예제 #4
0
def download(vurl=None):
    if vurl is None:
        return []
    if vurl.find("%20") != -1 or vurl.find("+") != -1:
        vurl = Unquote(vurl)
    try:
        from YDStreamExtractor import getVideoInfo
        from YDStreamExtractor import handleDownload
        info = getVideoInfo(vurl, resolve_redirects=True)
        playurl = info.streamURL
        dlpath = plugin.get_setting('downloadPath')
        if not os.path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
        plugin.log.info(msg="** DOWNLOAD VIDEO AT {0} **".format(vurl))
        plugin.log.info(msg=playurl)
        plugin.log.info(msg=str(repr(info)))
    except:
        plugin.notify(vurl, "Download Failed")
예제 #5
0
def single_YD(url, download=False, dl_info=False, audio=False):
    if dl_info:
        handleDownload(dl_info, bg=True)
        return
    else:
        info = getVideoInfo(url, quality=3, resolve_redirects=True)
    if info is None:
        print 'Fail to extract'
        return None
    elif info and download:
        if audio:
            try:
                for s in info.streams():
                    print 'len(s[', len(s['ytdl_format']['formats'])
                    for i in range(len(s['ytdl_format']['formats'])):
                        if s['ytdl_format']['formats'][i][
                                'format_id'] == '140':
                            print 'm4a found'
                            audio_url = s['ytdl_format']['formats'][i][
                                'url'].encode('utf-8', 'ignore')
                            title = s['title'].encode('utf-8', 'ignore')
                            info = {
                                'url': audio_url,
                                'title': title,
                                'media_type': 'audio'
                            }
                            break

            except Exception:
                print 'audio download failed'
                return

        handleDownload(info, bg=True)
    else:

        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                print stream_url
                return stream_url
            except Exception:
                return None
예제 #6
0
def single_YD(url, download=False, dl_info=False):
    if dl_info:
        handleDownload(dl_info, bg=True)
        return
    else:
        info = getVideoInfo(url, quality=3, resolve_redirects=True)
    if info is None:
        print 'Fail to extract'
        return None
    elif info and download:  ##handleDownload(info,duration=None,bg=False):
        handleDownload(info, bg=True)
    else:

        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                print stream_url
                return stream_url
            except Exception:
                return None
def single_YD(url, download=False, dl_info=False):
    if dl_info:
        handleDownload(dl_info, bg=True)
        return
    else:
        info = getVideoInfo(url, quality=3, resolve_redirects=True)
    if info is None:
        print "Fail to extract"
        return None
    elif info and download:  ##handleDownload(info,duration=None,bg=False):
        handleDownload(info, bg=True)
    else:

        for s in info.streams():
            try:
                stream_url = s["xbmc_url"].encode("utf-8", "ignore")
                print stream_url
                return stream_url
            except Exception:
                return None
예제 #8
0
def download(params):
    try:
        urlvideo = params.vidurl
        plugin.log(message=str("** download: " + str(repr(params))), level=xbmc.LOGINFO) 
        try:
            import YDStreamExtractor
            from YDStreamExtractor import getVideoInfo
            from YDStreamExtractor import handleDownload
        except:
            notify("Couldn't load YouTubeDL Addon")
        info = getVideoInfo(urlvideo, resolve_redirects=True)
        dlpath = plugin.get_setting('downloadpath')
        if not os.path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
    except:
        if urlvideo is not None:
            notify("Failed " + urlvideo)
        else:
            notify("No video URL was found to download")
    return None
예제 #9
0
def download(params):
    try:
        urlvideo = params.vidurl
        plugin.log(message=str("** download: " + str(repr(params))), level=xbmc.LOGINFO) 
        try:
            import YDStreamExtractor
            from YDStreamExtractor import getVideoInfo
            from YDStreamExtractor import handleDownload
        except:
            notify("Couldn't load YouTubeDL Addon")
        info = getVideoInfo(urlvideo, resolve_redirects=True)
        dlpath = plugin.get_setting('downloadpath')
        if not os.path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
    except:
        if urlvideo is not None:
            notify("Failed " + urlvideo)
        else:
            notify("No video URL was found to download")
    return None
예제 #10
0
def download(params):
    vurl = ''
    allok = False
    if params.video is not None:
        vurl = params.video
    else:
        return None
    try:
        from YDStreamExtractor import getVideoInfo
        from YDStreamExtractor import handleDownload
        info = getVideoInfo(vurl, resolve_redirects=True)
        dlpath = plugin.get_setting('downloadpath')
        if not path.exists(dlpath):
            dlpath = xbmc.translatePath("home://")
        handleDownload(info, bg=True, path=dlpath)
        allok = True
    except:
        allok = False
        xbmc.executebuiltin('Notification({0},{1})'.format(
            "FAILED to Download", vurl))
    if allok:
        xbmc.executebuiltin('Notification({0},{1})'.format(
            "OK! Download Started", vurl))
예제 #11
0
def single_YD(url,download=False,dl_info=False,audio=False):
    if dl_info:
        handleDownload(dl_info,bg=True)
        return
    else:
        info = getVideoInfo(url,quality=3,resolve_redirects=True)
    if info is None:
        print 'Fail to extract'
        return None    
    elif info and download : 
        if audio:
                try:
                    for s in info.streams():
                        print 'len(s[',len(s['ytdl_format']['formats'])
                        for i in range(len(s['ytdl_format']['formats'])):
                            if s['ytdl_format']['formats'][i]['format_id'] == '140':
                                print 'm4a found'
                                audio_url = s['ytdl_format']['formats'][i]['url'].encode('utf-8','ignore')                
                                title = s['title'].encode('utf-8','ignore')
                                info = {'url':audio_url,'title':title,'media_type':'audio'}
                                break
        
                except Exception:
                    print 'audio download failed'
                    return        
        
        handleDownload(info,bg=True)
    else:
    
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8','ignore')
                print stream_url
                return stream_url
            except Exception:
                return None 
예제 #12
0
def single_YD(url, download=False, dl_info=False, audio=False):
    if dl_info:
        handleDownload(dl_info, bg=True)
        return
    else:
        info = getVideoInfo(url, quality=3, resolve_redirects=True)
    if info is None:
        print "Fail to extract"
        return None
    elif info and download:
        if audio:
            try:
                for s in info.streams():
                    print "len(s[", len(s["ytdl_format"]["formats"])
                    for i in range(len(s["ytdl_format"]["formats"])):
                        if s["ytdl_format"]["formats"][i]["format_id"] == "140":
                            print "m4a found"
                            audio_url = s["ytdl_format"]["formats"][i]["url"].encode("utf-8", "ignore")
                            title = s["title"].encode("utf-8", "ignore")
                            info = {"url": audio_url, "title": title, "media_type": "audio"}
                            break

            except Exception:
                print "audio download failed"
                return

        handleDownload(info, bg=True)
    else:

        for s in info.streams():
            try:
                stream_url = s["xbmc_url"].encode("utf-8", "ignore")
                print stream_url
                return stream_url
            except Exception:
                return None
예제 #13
0
# -- coding utf-8 --
import xbmc,xbmcgui
try
    from YDStreamExtractor import getVideoInfo
    from YDStreamExtractor import handleDownload
    
except Exception
    print 'importing Error. You need youtubedl module which is in official xbmc.org'
    xbmc.executebuiltin(XBMC.Notification(LiveStreamsPro,Please [COLOR yellow]install Youtube-dl[COLOR] module ,10000,))
    
def single_YD(url,download=False,dl_info=False,audio=False)
    if dl_info
        handleDownload(dl_info,bg=True)
        return
    else
        info = getVideoInfo(url,quality=3,resolve_redirects=True)
    if info is None
        print 'Fail to extract'
        return None    
    elif info and download  
        if audio
                try
                    for s in info.streams()
                        print 'len(s[',len(s['ytdl_format']['formats'])
                        for i in range(len(s['ytdl_format']['formats']))
                            if s['ytdl_format']['formats'][i]['format_id'] == '140'
                                print 'm4a found'
                                audio_url = s['ytdl_format']['formats'][i]['url'].encode('utf-8','ignore')                
                                title = s['title'].encode('utf-8','ignore')
                                info = {'url'audio_url,'title'title,'media_type''audio'}
                                break