Skip to content

Can't get fetch result, even if proxy is set #508

@flashclub

Description

@flashclub

DO NOT DELETE THIS! Please take the time to fill this out properly. I am not able to help you if I do not know what you are executing and what error messages you are getting. If you are having problems with a specific video make sure to include the video id.

To Reproduce

Steps to reproduce the behavior:

What code / cli command are you executing?

I used webshare and bought Rotating Residential,
There are some username and password in the proxy list, and I used one of them
my code is:

from youtube_transcript_api import YouTubeTranscriptApi
from youtube_transcript_api.proxies import WebshareProxyConfig
import os
from dotenv import load_dotenv
load_dotenv()

if __name__ == "__main__":
    proxy_username = os.getenv('PROXY_USERNAME')
    proxy_password = os.getenv('PROXY_PASSWORD')
    ytt_api = YouTubeTranscriptApi(proxy_config=WebshareProxyConfig(
            proxy_username=proxy_username,
            proxy_password=proxy_password,
            filter_ip_locations=["us"],
        ))
    print('ytt_api: ',ytt_api)
    fetched_transcript = ytt_api.fetch("CuVPXLa-YLg")
    print('fetched_transcript: ',fetched_transcript)
    for snippet in fetched_transcript:
        print('text: ',snippet.text)

Which Python version are you using?

python --version
Python 3.13.4

Which version of youtube-transcript-api are you using?

pip show youtube-transcript-api
Name: youtube-transcript-api
Version: 1.2.2

Expected behavior

Get fetch results

Actual behaviour

An error was reported after executing the code

youtube_transcript_api._errors.RequestBlocked: 
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=CuVPXLa-YLg! This is most likely caused by:

YouTube is blocking requests from your IP. This usually is due to one of the following reasons:
- You have done too many requests and your IP has been blocked by YouTube
- You are doing requests from an IP belonging to a cloud provider (like AWS, Google Cloud Platform, Azure, etc.). Unfortunately, most IPs from cloud providers are blocked by YouTube.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions