python-20 / video-downloader

A python application to download videos
GNU General Public License v3.0
9 stars 10 forks source link

New features to be added #39

Open RyanSamman opened 4 years ago

RyanSamman commented 4 years ago

~ Backend

'''
Example for documentation of GUI elements
btnOK: 
    - It is a button to initialize the YouTube class and load in the video thumbnail and description 
    - has method ".clicked.connect(function)" to run a function when it is clicked
    - the function this button is connected to is "enterURL"
'''

~ GUI

chonix commented 4 years ago

for the RegexMatchError, to reproduce you need to enter a valid url that has not a youtube parsable ID, elseit's going to parse, try changing "watch" for "vatch" and it will parse. Crazy, huh?

I propose we change self.btnOK.clicked.connect(self.enterURL)

For the time being this change will do

    def enterURL(self):
        """ When OK button is pressed.         
        Retreive information of the video using pytube using the URL entered and process it        

        """

        link = self.lineEditURL.text()
        global ytube
        try:
            ytube = YouTube(link, on_progress_callback=self.download_progress)
        except:
            self.showPopUp("URL is not a valid Youtube Video")
            return

But I think we should introduce an even robust validation. For the time being we can use simple validation that videos can come only from youtube.com domain or similar. And then introduce a workaround that.

With this, we can check both first and second "invalid links" tasks.

RyanSamman commented 4 years ago

Older useful ideas & Comments: