Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 Error: Transcript is disabled on this video #11

Open
valenium opened this issue Dec 21, 2023 · 21 comments
Open

🚨 Error: Transcript is disabled on this video #11

valenium opened this issue Dec 21, 2023 · 21 comments

Comments

@valenium
Copy link

I have received this error message, despite putting a youtube video through that I had previously received a transcript for the day before.
image

Wondering if I have made too many requests?

@aehlke
Copy link

aehlke commented Feb 1, 2024

Still an issue?

@mfarhansadique
Copy link

mfarhansadique commented Mar 2, 2024

Ive been having this issue for a while. Sometimes it works sometimes it doesnt

https://youtu.be/Eim2GpHNQDg?feature=shared

could the issue have anything to do with '?feature=shared'

@cmsax
Copy link

cmsax commented Jul 15, 2024

always have this issue, I've confirmed that the original video's transcript is NOT DISABLED and tried multiple different network environment.

@OpeyemiSanusi
Copy link

OpeyemiSanusi commented Jul 17, 2024

I am goin through the exact same thing right now. It was working well all week long then boom - "Transcript is disabled on this video". I tried it on a video that I had a transcript for before and I got the same result.

@cmsax
Copy link

cmsax commented Jul 23, 2024

Based on a previous issue (the specific one escapes me), someone mentioned that the root cause is YouTube's official ban on the IP address where the script is executed. Unfortunately, there's nothing we can do to resolve this directly. The only workaround is to route the request through a proxy with an IP address that hasn't been banned.

@akmaldira
Copy link

Based on a previous issue (the specific one escapes me), someone mentioned that the root cause is YouTube's official ban on the IP address where the script is executed. Unfortunately, there's nothing we can do to resolve this directly. The only workaround is to route the request through a proxy with an IP address that hasn't been banned.

any way to fix it?

@hexxt-git
Copy link

it works on my home wifi but not on the server

@OpeyemiSanusi
Copy link

it works on my home wifi but not on the server

I have been meaning to get to this. I discovered this library is just a scrapper. Google banned a lot of public IP’s from being able to do that so the only way you can run it is through your own IP or a proxy and that’s a big risk because you’d probably be ban too. My current workaround is using a web scrapper that scrapes from a website that has it figured out. I am hoping to deploy another type of scraper in the cloud that works with a dynamic link and returns the transcript that way I wouldn’t be dealing with YouTube directly. Since it’s for personal use I shouldn’t draw too much attention to the website.

@hexxt-git
Copy link

if youre stuck on this youtubei.js package worked for me but its a bit more involved

@OpeyemiSanusi
Copy link

if youre stuck on this youtubei.js package worked for me but its a bit more involved

@9EED do you have working code you could share with the library or just explain how you got it to work

@hexxt-git
Copy link

@9EED do you have working code you could share with the library or just explain how you got it to work

yeah here is it @OpeyemiSanusi
i only got the text snippets here but you can get the times too

        import {Innertube} from 'youtubei.js/web';

	const youtube = await Innertube.create({
		lang: 'en',
		location: 'US',
		retrieve_player: false,
	});

	const fetchTranscript = async (): Promise<string[]> => {
		try {
			const info = await youtube.getInfo(url);
			const transcriptData = await info.getTranscript();
			return transcriptData.transcript.content.body.initial_segments.map((segment) => segment.snippet.text)
		} catch (error) {
			console.error('Error fetching transcript:', error);
			throw error;
		}
	};

@OpeyemiSanusi
Copy link

@9EED do you have working code you could share with the library or just explain how you got it to work

yeah here is it @OpeyemiSanusi i only got the text snippets here but you can get the times too

        import {Innertube} from 'youtubei.js/web';

	const youtube = await Innertube.create({
		lang: 'en',
		location: 'US',
		retrieve_player: false,
	});

	const fetchTranscript = async (): Promise<string[]> => {
		try {
			const info = await youtube.getInfo(url);
			const transcriptData = await info.getTranscript();
			return transcriptData.transcript.content.body.initial_segments.map((segment) => segment.snippet.text)
		} catch (error) {
			console.error('Error fetching transcript:', error);
			throw error;
		}
	};

@9EED I can't thank you enough! I got it to work! The transcript is a bit messy with the ([ __ ]) but it's way better than what i was working on. I appreciate this so much!

@RamGoel
Copy link

RamGoel commented Aug 10, 2024

@9EED Thanks a lot man! was struggling for almost 8 hours. This helped.

@quangthien27
Copy link

quangthien27 commented Oct 18, 2024

@hexxt-git thanks so much, that works for me too.

Tried youtube-transcript on Cloudflare, Firebase functions, Digital Ocean docker, they seem all banned or rate limited by Google. Then tried youtubei.js and it works! Used video ID instead of url in youtube.getInfo(url); though.

@hatemmezlini
Copy link

That is due to Youtube banning ISP ips. I have made a working solution using oauth2 that doesn't uses proxies and avoids Youtube ban. You can use it for free on Apify: https://apify.com/invideoiq/video-transcript-scraper. You only pay for Apify usage, however Apify gives you free credit of 5$ which will give you around 5000 transcripts

@davidysoards
Copy link

davidysoards commented Nov 3, 2024

i have the same issue on my Ubuntu server (local works fine) and I can confirm using youtubei.js does work (for now) using @hexxt-git's above method, except I pass in the ID of the video to getInfo not the URL.

@rafalzawadzki
Copy link

supadata.ai just does everything for you, including high volume, languages, proxies etc

@petesampras12
Copy link

@9EED do you have working code you could share with the library or just explain how you got it to work

yeah here is it @OpeyemiSanusi i only got the text snippets here but you can get the times too

        import {Innertube} from 'youtubei.js/web';

	const youtube = await Innertube.create({
		lang: 'en',
		location: 'US',
		retrieve_player: false,
	});

	const fetchTranscript = async (): Promise<string[]> => {
		try {
			const info = await youtube.getInfo(url);
			const transcriptData = await info.getTranscript();
			return transcriptData.transcript.content.body.initial_segments.map((segment) => segment.snippet.text)
		} catch (error) {
			console.error('Error fetching transcript:', error);
			throw error;
		}
	};

@9EED I can't thank you enough! I got it to work! The transcript is a bit messy with the ([ __ ]) but it's way better than what i was working on. I appreciate this so much!

Are you using residential proxies to not get banned by youtube due to many requests?

@SunkaraboinaPraveenKumar

Did it work on deployment also . Doesn't seem to work for mine

import { NextResponse } from 'next/server';
import { Innertube } from 'youtubei.js/web';

export async function GET(req) {
const url = new URL(req.url);
const videoUrl = url.searchParams.get('url');

if (!videoUrl) {
    return NextResponse.json({ error: 'No URL provided' }, { status: 400 });
}

try {
    const videoId = videoUrl.split('v=')[1]?.split('&')[0];
    if (!videoId) {
        return NextResponse.json({ error: 'Invalid YouTube URL' }, { status: 400 });
    }

    // Create an Innertube instance
    const youtube = await Innertube.create({
        lang: 'en',
        location: 'IN',
        retrieve_player: false,
    });

    // Fetch video info and transcript
    const info = await youtube.getInfo(videoUrl);
    const transcriptData = await info.getTranscript();

    if (!transcriptData || transcriptData.transcript.content.body.initial_segments.length === 0) {
        return NextResponse.json({ error: 'No transcript available' }, { status: 500 });
    }

    // Extract the transcript text
    const transcript = transcriptData.transcript.content.body.initial_segments.map(
        (segment) => segment.snippet.text
    );

    return NextResponse.json({ result: transcript });
} catch (error) {
    console.error('Error fetching transcript:', error);
    return NextResponse.json({ error: error.message }, { status: 500 });
}

}

@SunkaraboinaPraveenKumar

i have the same issue on my Ubuntu server (local works fine) and I can confirm using youtubei.js does work (for now) using @hexxt-git's above method, except I pass in the ID of the video to getInfo not the URL.

can you share code of extraction by videoId

@hexxt-git
Copy link

can you share code of extraction by videoId
@SunkaraboinaPraveenKumar it already works if you put in just the id in youtube.getInfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests