pytube.exceptions.RegexMatchError: no match for get_throttling_function_name

Problem: Downloading YouTube Videos with Pytube

I’m trying to download YouTube videos using Pytube and I’m getting the error pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple. This issue prevents me from downloading any video or audio.

def video_downloader(video_url_list: List[str], download_folder: str) -> None:
    """
    Download videos from a list of YouTube video URLs.
    
    Args:
        video_urls (List[str]): The list of YouTube video URLs to download.
        download_folder (str): The folder to save the downloaded videos.
    """
    successful_downloads = 0
    valid_urls: List[str] = []

    for url in video_url_list:
        if not url:
            continue

        try:
            with tempfile.TemporaryDirectory() as temp_dir:
                cleaned_url = clean_youtube_url(url=url)
                if _get_streams(url=cleaned_url, temp_dir=temp_dir):
                    create_folder(download_folder)
                    _merge_streams(
                        temp_dir=temp_dir, url=url, download_folder=download_folder
                    )
                    logger.info(f"The video from {url} was downloaded successfully")
                    successful_downloads += 1
                    valid_urls.append(url)
                else:
                    logger.warning(f"No valid video found at the URL: {url}")

        except Exception as e:
            logger.error(
                f"Error has occurred while downloading the video from {url}: {e}"
            )
            print(e)
    if successful_downloads != 0 and (successful_downloads == len(valid_urls)):
        messagebox.showinfo(
            title="Finished download",
            message=f"Your download is complete!.\n\n\t{successful_downloads}/{len(video_url_list[1:])}",
        )

Are there any possible solutions to this problem?

Possible solution to the problem:

The error pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple is likely caused by an outdated version of Pytube. To resolve this issue, you can try updating Pytube to the latest version.

You can update Pytube by running the following command in your terminal or command prompt:

pip install --upgrade pytube

After updating Pytube, try running your code again and see if the issue persists. If the issue still occurs, you may need to check if there are any compatibility issues with the specific videos you are trying to download or explore alternative libraries for downloading YouTube videos.