Example #1
0
    def valida(self):
        try:
            if self.vskytube.btn_folder.text() == '<':
                self.vskytube.btn_folder.setText('>')
                self.vskytube.treeView.setVisible(False)
                self.vskytube.btn_folder_2.setVisible(False)
                self.vskytube.lbl_perfil.setVisible(False)
                self.vskytube.lbl_perfil.setVisible(False)
            else:
                pass


            self.vskytube.groupBox.setVisible(False)
            self.resize(579,66)
            self.vskytube.lbl_imagen.setText('sin imagen')
            if os.path.isfile(os.path.dirname(sys.executable)+ '\\skytube.jpg'):
                os.remove(os.path.dirname(sys.executable) + '\\skytube.jpg')

            self.vskytube.groupBox.setVisible(True)
            video_id = self.vskytube.lineEdit.text()

            if video_id.split('?v=') == 1:
                video_id = video_id.split('?v=')

            if len(video_id) == 1:
                global url
                url= 'http://www.youtube.com/watch?v=' + video_id[1]
            else:
                global url
                url= 'http://www.youtube.com/watch?v=' + video_id



            global video

            video = Pafy(url)
            best = video.getbest(preftype="mp4")
            self.vskytube.lbl_calidad.setText(best.resolution + ' Extencion: ' + best.extension)

            self.vskytube.groupBox.setStyleSheet("color:green;")
            self.vskytube.groupBox.setTitle(video.title)
            self.vskytube.lbl_autor.setText(video.author)
            self.vskytube.lbl_duracion.setText(video.duration)
            self.vskytube.lbl_id.setText(video.videoid)
            self.vskytube.lbl_rating.setText(str(video.rating))
            self.vskytube.lbl_visto.setText(str(video.viewcount))
            self.resize(579,250)


            #os.chdir(os.path.dirname(sys.executable))
            url = video.thumb
            file = ('skytube.jpg')
            urllib.request.urlretrieve(url, file)
            img = (os.path.dirname(sys.executable) + '\skytube.jpg')
            #img = (video.thumb)
            #self.vskytube.lbl_imagen.setText('<img src="'+ img +'" />')
            self.vskytube.lbl_imagen.setPixmap(QtGui.QPixmap(img))
        except Exception as e:
            QtGui.QMessageBox.about(self,'Error SkyTube ',' No existe el video favor de verificar.')
            QtGui.QMessageBox.about(self,'Error SkyTube ',str(e))
Example #2
0
    def valida_lista(self):
        try:
            self.vskytube.groupBox.setVisible(False)
            self.vskytube.lbl_imagen.setText('sin imagen')
            if os.path.isfile(
                    os.path.dirname(sys.executable) + '\\skytube.jpg'):
                os.remove(os.path.dirname(sys.executable) + '\\skytube.jpg')

            if os.path.isfile('/tmp/skytube.jpg'):
                os.remove('/tmp/skytube.jpg')

            item = self.vskytube.lst_encola.currentItem()
            url = item.text()

            video = Pafy(url)
            best = video.getbest(preftype=self.formato())
            if self.formato() == 'mp3':
                self.vskytube.lbl_calidad.setText(' Extencion: mp3')
            else:
                self.vskytube.lbl_calidad.setText(best.resolution +
                                                  ' Extencion: ' +
                                                  best.extension)

            self.vskytube.groupBox.setTitle(video.title)
            self.vskytube.lbl_autor.setText(video.author)
            self.vskytube.lbl_duracion.setText(video.duration)
            self.vskytube.lbl_id.setText(video.videoid)
            self.vskytube.lbl_rating.setText(str(video.rating))
            self.vskytube.lbl_visto.setText(str(video.viewcount))
            self.vskytube.btn_valida_2.setVisible(False)

            url = video.thumb
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                file = ('skytube.jpg')
            if 'linux' in self.sistema():
                file = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                file = ('skytube.jpg')

            urllib.request.urlretrieve(url, file)

            if 'win32' in self.sistema() or 'win64' in self.sistema():
                img = (os.path.dirname(sys.executable) + '\skytube.jpg')
            if 'linux' in self.sistema():
                img = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                img = ('/skytube.jpg')

            self.vskytube.lbl_imagen.setPixmap(QtGui.QPixmap(img))
            self.vskytube.groupBox.setVisible(True)
        except Exception as e:
            self.vskytube.groupBox.setVisible(False)
            QtGui.QMessageBox.about(
                self, 'Error en Link ', 'El Link : ' + item.text() +
                ' No existe..\n Se eliminara de la lista..' + str(e))
            self.elimina_item()
Example #3
0
    def valida_lista(self):
        try:
            self.vskytube.groupBox.setVisible(False)
            self.vskytube.lbl_imagen.setText('sin imagen')
            if os.path.isfile(os.path.dirname(sys.executable)+ '\\skytube.jpg'):
                os.remove(os.path.dirname(sys.executable) + '\\skytube.jpg')

            if os.path.isfile('/tmp/skytube.jpg'):
                os.remove('/tmp/skytube.jpg')

            item = self.vskytube.lst_encola.currentItem()
            url = item.text()

            video = Pafy(url)
            best = video.getbest(preftype=self.formato())
            if self.formato() == 'mp3':
                self.vskytube.lbl_calidad.setText(' Extencion: mp3')
            else:
                self.vskytube.lbl_calidad.setText(best.resolution + ' Extencion: ' + best.extension)

            self.vskytube.groupBox.setTitle(video.title)
            self.vskytube.lbl_autor.setText(video.author)
            self.vskytube.lbl_duracion.setText(video.duration)
            self.vskytube.lbl_id.setText(video.videoid)
            self.vskytube.lbl_rating.setText(str(video.rating))
            self.vskytube.lbl_visto.setText(str(video.viewcount))
            self.vskytube.btn_valida_2.setVisible(False)

            url = video.thumb
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                file = ('skytube.jpg')
            if 'linux' in self.sistema():
                file = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                file = ('skytube.jpg')

            urllib.request.urlretrieve(url, file)

            if 'win32' in self.sistema() or 'win64' in self.sistema():
                img = (os.path.dirname(sys.executable) + '\skytube.jpg')
            if 'linux' in self.sistema():
                img = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                img = ('/skytube.jpg')

            self.vskytube.lbl_imagen.setPixmap(QtGui.QPixmap(img))
            self.vskytube.groupBox.setVisible(True)
        except Exception as e:
            self.vskytube.groupBox.setVisible(False)
            QtGui.QMessageBox.about(self,'Error en Link ','El Link : ' + item.text() + ' No existe..\n Se eliminara de la lista..' + str(e))
            self.elimina_item()
Example #4
0
class Downloader():
    
    def __init__(self, url, out, author=u"", title=u""):
        self.url = url
        self.out = out
        self.filename = u""
        self.tmp = u"tmp.mp3"
        self.author = author 
        self.title = title
    
    def __createVideo(self):
        self.video = Pafy(self.url)

    def __download(self):
        best = self.video.getbest(preftype="mp4")
        self.filename = u"out." + best.extension
        best.download(progress=True, filepath=self.filename.encode('utf-8'))
    
    """ Converts video to mp3 using ffmpeg and 
    adds tags if they were given"""

    def __convert(self):
        try:
            print "\n\t\t\tExtracting audio...\n"

            check_call([u'ffmpeg', u'-v', u'0', u'-i',
            self.filename, u'-b', u'320K', self.tmp])
            
            print "\n\t\t\tAdding tags...\n"
            
            check_call([u'ffmpeg', u'-v', u'0', u'-i', self.tmp, u'-b', u'320K',
            u'-id3v2_version', '3',  
            u'-metadata', u'title=' + self.title, 
            u'-metadata', u'artist=' + self.author, self.out])
        except OSError as e:
            print '\nError converting file!\n'
            self.clean()
            raise e

    """ Removes video and mp3 file """
    
    def clean(self):
        try:
            os.remove(self.filename)
        except:
            print "\nError cleaning!\n"
        try:
            os.remove(self.tmp)
        except:
            print "\nError cleaning!\n"
        try:
            os.remove(self.out)
        except OSError as e:
            print "\nError cleaning!\n"
            raise e
   
    def process(self):
        self.__createVideo()
        self.__download()
        self.__convert()
Example #5
0
    def add(self):
        try:

            video_id = self.vskytube.lineEdit.text()
            if len(video_id) == 11:
                url = 'http://www.youtube.com/watch?v=' + video_id

            elif len(str(video_id).split('?v=')) == 2:
                video_id = video_id.split('?v=')

            else:
                self.setclipboard()
                self.vskytube.lineEdit.clear()
                QtGui.QMessageBox.about(self, 'Alerta Link! ',
                                        'Link No valido!')
                return
            if len(video_id) == 2:
                url = 'http://www.youtube.com/watch?v=' + video_id[1]
            else:
                url = 'http://www.youtube.com/watch?v=' + video_id

            items = []
            for index in range(self.vskytube.lst_encola.count()):
                items.append(self.vskytube.lst_encola.item(index).text())

            existe = 'No'
            for i in items:
                if url == i:
                    existe = 'Si'

            if existe == 'No':
                self.setclipboard()
                if Pafy(url):
                    self.vskytube.lst_encola.addItem(url)
                    self.vskytube.lineEdit.clear()
            else:
                self.vskytube.lineEdit.clear()
                self.setclipboard()
                QtGui.QMessageBox.about(
                    self, 'Alerta Link! ',
                    'Este Link ya fue agregado a la lista!')
        except:
            self.vskytube.lineEdit.setText('Link No Valido')
            self.setclipboard()
Example #6
0
    if len(sys.argv) >= 2:

        url = sys.argv[1]
        video_id = url

        if video_id.split('?v=') == 1:
            video_id = video_id.split('?v=')

        if len(video_id) == 1:

            url= 'http://www.youtube.com/watch?v=' + video_id[1]
        else:

            url= 'http://www.youtube.com/watch?v=' + video_id

        video =Pafy(url)
        os.system('cls')
        print('')
        print('SkyTube Modo Consola =D ... V1.1')
        print('')
        print('')
        print('Tu video ' + video.title + ' se esta descargando ..')
        print('')
        print('')

        best = video.getbest(preftype="mp4")
        titulo = best.title
        titulo = str(titulo).replace('"','')
        filename = os.path.join (os.environ['USERPROFILE'],'videos') + '\\' + titulo + '.' + best.extension
        best.download(quiet=False, filepath=filename)
        print('Tu video se Descargo Correctamente, lo encuentras en tu carpeta de Videos .. ')
Example #7
0
#!/usr/bin/python

from pafy import Pafy

url = "http://www.youtube.com/watch?v=cyMHZVT91Dw"

# create a video instance

video = Pafy(url)

# get certain attributes

print("\n\n")
print("Title, Rating, Length...")
print("------------------------")
print(video.title)
print(video.rating)  # out of 5
print(video.length)  # seconds
print("\n")

# get video metadata

print("Video meta info...")
print("------------------")
print(video)
print("\n")

# show all formats for a video:

print("All available formats...")
print("------------------------")
Example #8
0
#!/usr/bin/python

from pafy import Pafy

url = "http://www.youtube.com/watch?v=cyMHZVT91Dw"

# create a video instance

video = Pafy(url)

# get certain attributes

print("\n\n")
print("Title, Rating, Length...")
print("------------------------")
print(video.title)
print(video.rating)  # out of 5
print(video.length)  # seconds
print("\n")

# get video metadata

print("Video meta info...")
print("------------------")
print(video)
print("\n")

# show all formats for a video:

print("All available formats...")
print("------------------------")
Example #9
0
 
            video_id = url
 
            if video_id.split('?v=') == 1:
                video_id = video_id.split('?v=')
 
            if len(video_id) == 1:
 
                url= 'http://www.youtube.com/watch?v=' + video_id[1]
            else:
 
                url= 'http://www.youtube.com/watch?v=' + video_id
 
 
 
            video =Pafy(url)
            if 'win32' in sistema() or 'win64' in sistema():
                os.system('cls')
            if 'darwin' in sistema():
                os.system('clear')
            if 'linux' in sistema():
                os.system('clear')
            stream = video.getbest(preftype=formato.lower())
            size = stream.get_filesize()
 
            print('           _____ _        _____     _')
            print('          /  ___| |      |_   _|   | |')
            print('          \  --.| | ___   _| |_   _| |__   ___ ')
            print("           `--. \ |/ / | | | | | | | |_ \\ / _ \\")
            print('          /\__/ /   <| |_| | | |_| | |_) |  __/')
            print('          \____/|_|\_\\__,  \_/\__,_|_.__/ \___|')
Example #10
0
 def __createVideo(self):
     self.video = Pafy(self.url)
Example #11
0
    def valida(self):
        try:
            self.oculta()

            self.vskytube.groupBox.setVisible(False)
            self.resize(585, 121)
            self.vskytube.lbl_imagen.setText('sin imagen')
            if os.path.isfile(
                    os.path.dirname(sys.executable) + '\\skytube.jpg'):
                os.remove(os.path.dirname(sys.executable) + '\\skytube.jpg')

            if os.path.isfile('/tmp/skytube.jpg'):
                os.remove('/tmp/skytube.jpg')

            self.vskytube.groupBox.setVisible(True)

            video_id = self.vskytube.lineEdit.text()

            if len(video_id) == 11:
                url = 'http://www.youtube.com/watch?v=' + video_id

            if video_id.split('?v=') == 1:
                video_id = video_id.split('?v=')

            if len(video_id) == 1:
                global url
                url = 'http://www.youtube.com/watch?v=' + video_id[1]
            else:
                global url
                url = 'http://www.youtube.com/watch?v=' + video_id

            global video

            video = Pafy(url)
            best = video.getbest(preftype=self.formato())

            if self.formato() == 'mp3':
                self.vskytube.lbl_calidad.setText(' Extencion: mp3')
            else:
                self.vskytube.lbl_calidad.setText(best.resolution +
                                                  ' Extencion: ' +
                                                  best.extension)

            self.vskytube.groupBox.setTitle(video.title)
            self.vskytube.lbl_autor.setText(video.author)
            self.vskytube.lbl_duracion.setText(video.duration)
            self.vskytube.lbl_id.setText(video.videoid)
            self.vskytube.lbl_rating.setText(str(video.rating))
            self.vskytube.lbl_visto.setText(str(video.viewcount))
            self.resize(579, 288)
            self.vskytube.btn_valida_2.setVisible(True)

            url_img = video.thumb
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                file = ('skytube.jpg')
            if 'linux' in self.sistema():
                file = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                file = ('skytube.jpg')
            urllib.request.urlretrieve(url_img, file)
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                img = (os.path.dirname(sys.executable) + '\skytube.jpg')
            if 'linux' in self.sistema():
                img = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                img = ('/skytube.jpg')

            self.vskytube.lbl_imagen.setPixmap(QtGui.QPixmap(img))
        except Exception as e:
            QtGui.QMessageBox.about(self, 'Error SkyTube ',
                                    ' No existe el video favor de verificar.')
            QtGui.QMessageBox.about(self, 'Error SkyTube ', str(e))
Example #12
0
    def descarga(self):
        try:
            self.vskytube.p_bar.setMinimum(0)
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                if self.formato() == 'mp3':
                    if os.path.isfile('ffmpeg.exe'):
                        pass
                    else:
                        respuesta = QtGui.QMessageBox.question(
                            self, 'Descarga Mp3 ',
                            'Necesitas ffmpeg  para descargar MP3 \n'
                            'Quieres descargarlo? ', QtGui.QMessageBox.Yes,
                            QtGui.QMessageBox.No)
                        if respuesta == QtGui.QMessageBox.Yes:
                            self.formato_combo()
                        else:
                            return

            if 'darwin' in self.sistema():
                if self.formato() == 'mp3':
                    if os.path.isfile('ffmpeg'):
                        pass
                    else:
                        respuesta = QtGui.QMessageBox.question(
                            self, 'Descarga Mp3 ',
                            'Necesitas ffmpeg  para descargar MP3 \n'
                            'Quieres descargarlo? ', QtGui.QMessageBox.Yes,
                            QtGui.QMessageBox.No)
                        if respuesta == QtGui.QMessageBox.Yes:
                            self.formato_combo()
                        else:
                            return
            video = Pafy(url)
            if self.formato() == 'mp3':
                bestaudio = video.getbestaudio()
                size = bestaudio.get_filesize()
                titulo = bestaudio.title
                extension = bestaudio.extension
                desc = bestaudio.url
            else:
                stream = video.getbest(preftype=self.formato())
                size = stream.get_filesize()
                titulo = stream.title
                extension = stream.extension
                desc = stream.url
            self.vskytube.lineEdit.setVisible(False)
            self.vskytube.btn_valida.setVisible(False)
            self.vskytube.label_7.setVisible(False)
            self.vskytube.btn_folder.setVisible(False)
            self.vskytube.treeView.setVisible(False)
            self.vskytube.btn_folder_2.setVisible(False)
            self.vskytube.lbl_perfil.setVisible(False)
            self.vskytube.groupBox.setVisible(False)
            self.vskytube.groupBox_2.setVisible(False)
            self.vskytube.btn_add.setVisible(False)
            self.vskytube.ck_lst_auto.setVisible(False)
            self.vskytube.ck_captura.setVisible(False)
            self.vskytube.lbl_desc.setStyleSheet("color:red;")
            self.vskytube.lbl_desc.setText('Descargando ...' + titulo)
            self.vskytube.lbl_desc.setVisible(True)
            self.vskytube.lbl_barr.setVisible(True)
            self.vskytube.p_bar.setVisible(True)
            self.resize(489, 82)
            QtGui.QMessageBox.about(
                self, 'Empezando Descarga ... ',
                'La descarga puede tardar varios minutos, dependiendo de tu conexion ...'
            )

            titulo = str(titulo).replace('.', '')
            titulo = str(titulo).replace('"', '')
            titulo = str(titulo).replace(':', '')
            titulo = str(titulo).replace('_', '')
            titulo = str(titulo).replace('-', '')
            titulo = str(titulo).replace(';', '')
            titulo = str(titulo).replace('|', '')
            titulo = str(titulo).replace("'", '')
            titulo = str(titulo).replace("+", '')
            titulo = str(titulo).replace("!", '')
            titulo = str(titulo).replace("/", '')
            titulo = str(titulo).replace("\\", '')
            titulo = str(titulo).replace("*", '')
            titulo = str(titulo).replace("#", '')
            titulo = str(titulo).replace("%", '')
            titulo = str(titulo).replace("&", '')
            titulo = str(titulo).replace("(", '')
            titulo = str(titulo).replace(")", '')
            titulo = str(titulo).replace("?", '')
            titulo = str(titulo).replace("¿", '')
            titulo = str(titulo).replace("¡", '')
            titulo = str(titulo).replace("[", '')
            titulo = str(titulo).replace("]", '')
            titulo = str(titulo).replace("{", '')
            titulo = str(titulo).replace("}", '')
            titulo = str(titulo).replace("=", '')
            titulo = str(titulo).replace("~", '')
            titulo = str(titulo).replace("<", '')
            titulo = str(titulo).replace(">", '')

            if 'win32' in self.sistema() or 'win64' in self.sistema():

                filename = os.path.join(
                    os.environ['USERPROFILE'],
                    'videos') + '\\' + titulo + '.' + extension
            else:
                filename = os.path.join(
                    os.environ['HOME'],
                    'Movies') + '/' + titulo + '.' + extension

            urllib.request.urlretrieve(desc,
                                       filename,
                                       reporthook=self.funcionprogreso)

            if self.formato() == 'mp3':
                if 'win32' in self.sistema() or 'win64' in self.sistema():
                    m4a = os.path.join(
                        os.environ['USERPROFILE'],
                        'videos') + '\\' + titulo + '.' + extension
                    mp3 = os.path.join(os.environ['USERPROFILE'],
                                       'videos') + '\\' + titulo + '.mp3'

                    self.ejecutaExe('ffmpeg.exe -i \"%s\" -y \"%s\"' %
                                    (m4a, mp3))
                    os.remove(filename)
                if 'darwin' in self.sistema():
                    m4a = os.path.join(
                        os.environ['HOME'],
                        'Movies') + '/' + titulo + '.' + extension
                    mp3 = os.path.join(os.environ['HOME'],
                                       'Movies') + '/' + titulo + '.mp3'

                    self.ejecutaExe('./ffmpeg -i \"%s\" -y \"%s\"' %
                                    (m4a, mp3))
                    os.remove(filename)

            self.setclipboard()
            self.vskytube.lineEdit.clear()
            QtGui.QMessageBox.about(self, 'Descarga Finalizada',
                                    ' Tu descarga Finalizo')
            self.crea_directorio()
            self.resize(880, 321)
            QtCore.QCoreApplication.processEvents()
            self.muestra()

        except Exception as e:
            QtGui.QMessageBox.about(self, 'Error Descarga', str(e))
Example #13
0
    def valida(self):
        try:
            self.oculta()

            self.vskytube.groupBox.setVisible(False)
            self.resize(585,121)
            self.vskytube.lbl_imagen.setText('sin imagen')
            if os.path.isfile(os.path.dirname(sys.executable)+ '\\skytube.jpg'):
                os.remove(os.path.dirname(sys.executable) + '\\skytube.jpg')

            if os.path.isfile('/tmp/skytube.jpg'):
                os.remove('/tmp/skytube.jpg')

            self.vskytube.groupBox.setVisible(True)

            video_id = self.vskytube.lineEdit.text()

            if len(video_id) == 11:
                url= 'http://www.youtube.com/watch?v=' + video_id


            if video_id.split('?v=') == 1:
                video_id = video_id.split('?v=')

            if len(video_id) == 1:
                global url
                url= 'http://www.youtube.com/watch?v=' + video_id[1]
            else:
                global url
                url= 'http://www.youtube.com/watch?v=' + video_id



            global video

            video = Pafy(url)
            best = video.getbest(preftype=self.formato())

            if self.formato() == 'mp3':
                self.vskytube.lbl_calidad.setText(' Extencion: mp3')
            else:
                self.vskytube.lbl_calidad.setText(best.resolution + ' Extencion: ' + best.extension)

            self.vskytube.groupBox.setTitle(video.title)
            self.vskytube.lbl_autor.setText(video.author)
            self.vskytube.lbl_duracion.setText(video.duration)
            self.vskytube.lbl_id.setText(video.videoid)
            self.vskytube.lbl_rating.setText(str(video.rating))
            self.vskytube.lbl_visto.setText(str(video.viewcount))
            self.resize(579,288)
            self.vskytube.btn_valida_2.setVisible(True)



            url_img = video.thumb
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                file = ('skytube.jpg')
            if 'linux' in self.sistema():
                file = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                file = ('skytube.jpg')
            urllib.request.urlretrieve(url_img, file)
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                img = (os.path.dirname(sys.executable) + '\skytube.jpg')
            if 'linux' in self.sistema():
                img = ('/tmp/skytube.jpg')
            if 'darwin' in self.sistema():
                img = ('/skytube.jpg')


            self.vskytube.lbl_imagen.setPixmap(QtGui.QPixmap(img))
        except Exception as e:
            QtGui.QMessageBox.about(self,'Error SkyTube ', ' No existe el video favor de verificar.')
            QtGui.QMessageBox.about(self,'Error SkyTube ', str(e))
Example #14
0
    def descarga(self):
        try:
            self.vskytube.p_bar.setMinimum(0)
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                if self.formato() == 'mp3':
                    if os.path.isfile('ffmpeg.exe'):
                        pass
                    else:
                        respuesta = QtGui.QMessageBox.question(self, 'Descarga Mp3 ', 'Necesitas ffmpeg  para descargar MP3 \n'
                                                        'Quieres descargarlo? ', QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
                        if respuesta == QtGui.QMessageBox.Yes:
                            self.formato_combo()
                        else:
                            return

            if 'darwin' in self.sistema():
                if self.formato() == 'mp3':
                    if os.path.isfile('ffmpeg'):
                        pass
                    else:
                        respuesta = QtGui.QMessageBox.question(self, 'Descarga Mp3 ', 'Necesitas ffmpeg  para descargar MP3 \n'
                                                        'Quieres descargarlo? ', QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
                        if respuesta == QtGui.QMessageBox.Yes:
                            self.formato_combo()
                        else:
                            return
            video =Pafy(url)
            if self.formato() == 'mp3':
                bestaudio = video.getbestaudio()
                size = bestaudio.get_filesize()
                titulo = bestaudio.title
                extension = bestaudio.extension
                desc = bestaudio.url
            else:
                stream = video.getbest(preftype=self.formato())
                size = stream.get_filesize()
                titulo = stream.title
                extension = stream.extension
                desc = stream.url
            self.vskytube.lineEdit.setVisible(False)
            self.vskytube.btn_valida.setVisible(False)
            self.vskytube.label_7.setVisible(False)
            self.vskytube.btn_folder.setVisible(False)
            self.vskytube.treeView.setVisible(False)
            self.vskytube.btn_folder_2.setVisible(False)
            self.vskytube.lbl_perfil.setVisible(False)
            self.vskytube.groupBox.setVisible(False)
            self.vskytube.groupBox_2.setVisible(False)
            self.vskytube.btn_add.setVisible(False)
            self.vskytube.ck_lst_auto.setVisible(False)
            self.vskytube.ck_captura.setVisible(False)
            self.vskytube.lbl_desc.setStyleSheet("color:red;")
            self.vskytube.lbl_desc.setText('Descargando ...' + titulo )
            self.vskytube.lbl_desc.setVisible(True)
            self.vskytube.lbl_barr.setVisible(True)
            self.vskytube.p_bar.setVisible(True)
            self.resize(489,82)
            QtGui.QMessageBox.about(self,'Empezando Descarga ... ','La descarga puede tardar varios minutos, dependiendo de tu conexion ...')



            titulo = str(titulo).replace('.','')
            titulo = str(titulo).replace('"','')
            titulo = str(titulo).replace(':','')
            titulo = str(titulo).replace('_','')
            titulo = str(titulo).replace('-','')
            titulo = str(titulo).replace(';','')
            titulo = str(titulo).replace('|','')
            titulo = str(titulo).replace("'",'')
            titulo = str(titulo).replace("+",'')
            titulo = str(titulo).replace("!",'')
            titulo = str(titulo).replace("/",'')
            titulo = str(titulo).replace("\\",'')
            titulo = str(titulo).replace("*",'')
            titulo = str(titulo).replace("#",'')
            titulo = str(titulo).replace("%",'')
            titulo = str(titulo).replace("&",'')
            titulo = str(titulo).replace("(",'')
            titulo = str(titulo).replace(")",'')
            titulo = str(titulo).replace("?",'')
            titulo = str(titulo).replace("¿",'')
            titulo = str(titulo).replace("¡",'')
            titulo = str(titulo).replace("[",'')
            titulo = str(titulo).replace("]",'')
            titulo = str(titulo).replace("{",'')
            titulo = str(titulo).replace("}",'')
            titulo = str(titulo).replace("=",'')
            titulo = str(titulo).replace("~",'')
            titulo = str(titulo).replace("<",'')
            titulo = str(titulo).replace(">",'')

            if 'win32' in self.sistema() or 'win64' in self.sistema():

                filename = os.path.join (os.environ['USERPROFILE'],'videos') + '\\' + titulo + '.' + extension
            else:
                filename = os.path.join (os.environ['HOME'],'Movies') + '/' + titulo + '.' + extension


            urllib.request.urlretrieve(desc, filename,reporthook=self.funcionprogreso)

            if self.formato() == 'mp3':
                if 'win32' in self.sistema() or 'win64' in self.sistema():
                    m4a = os.path.join (os.environ['USERPROFILE'],'videos') + '\\' + titulo + '.' + extension
                    mp3 = os.path.join (os.environ['USERPROFILE'],'videos') + '\\' + titulo + '.mp3'


                    self.ejecutaExe('ffmpeg.exe -i \"%s\" -y \"%s\"' % (m4a , mp3))
                    os.remove(filename)
                if 'darwin' in self.sistema():
                    m4a = os.path.join (os.environ['HOME'],'Movies') + '/' + titulo + '.' + extension
                    mp3 = os.path.join (os.environ['HOME'],'Movies') + '/' + titulo + '.mp3'

                    self.ejecutaExe('./ffmpeg -i \"%s\" -y \"%s\"' % (m4a , mp3))
                    os.remove(filename)


            self.setclipboard()
            self.vskytube.lineEdit.clear()
            QtGui.QMessageBox.about(self,'Descarga Finalizada', ' Tu descarga Finalizo')
            self.crea_directorio()
            self.resize(880,321)
            QtCore.QCoreApplication.processEvents()
            self.muestra()



        except Exception as e:
            QtGui.QMessageBox.about(self,'Error Descarga', str(e))