music2storage/service.py
def download(self, url):
        """
        Downloads a MP4 or WebM file that is associated with the video at the URL passed.

        :param str url: URL of the video to be downloaded
        :return str: Filename of the file in local storage
        """

        try:
            yt = YouTube(url)
        except RegexMatchError:
            log.error(f"Cannot download file at {url}")
        else:
            stream = yt.streams.first()
            log.info(f"Download for {stream.default_filename} has started")
            start_time = time()
            stream.download()
            end_time = time()
            log.info(f"Download for {stream.default_filename} has finished in {end_time - start_time} seconds")
            return stream.default_filename
def download(self, url):
        try:
            yt = YouTube(url)
        except RegexMatchError:
            log.error(f"Cannot download file at {url}")
        else:
            stream = yt.streams.first()
            log.info(f"Download for {stream.default_filename} has started")
            start_time = time()
            stream.download()
            end_time = time()
            log.info(f"Download for {stream.default_filename} has finished in {end_time - start_time} seconds")
            return stream.default_filename
def download ( self , url ) : try : yt = YouTube ( url ) except RegexMatchError : log . error ( f"Cannot download file at {url}" ) else : stream = yt . streams . first ( ) log . info ( f"Download for {stream.default_filename} has started" ) start_time = time ( ) stream . download ( ) end_time = time ( ) log . info ( f"Download for {stream.default_filename} has finished in {end_time - start_time} seconds" ) return stream . default_filename
Downloads a MP4 or WebM file that is associated with the video at the URL passed.

        :param str url: URL of the video to be downloaded
        :return str: Filename of the file in local storage
Downloads a MP4 or WebM file that is associated with the video at the URL passed .