We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I use proxy, but get error
Line:40 🍷 url https://www.youtube.com/iframe_api Fetch error for https://www.youtube.com/iframe_api. Retrying in 2 seconds...
Line:40 🍷 url https://www.youtube.com/sw.js_data Fetch error for https://www.youtube.com/sw.js_data. Retrying in 2 seconds...
Tell me why? Please, Thank you.
const initializeInnertube = async () => { const proxyAgent = new HttpsProxyAgent( "https://v2sub.com/xxx" ); return await Innertube.create({ fetch: async (input, init) => { const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url; const modifiedInit = { ...init, method: init?.method || (init?.body ? "POST" : "GET"), agent: proxyAgent, }; if (modifiedInit.method === "POST") modifiedInit.headers = { ...modifiedInit.headers, "Content-Type": "application/json", }; const maxRetries = 5; let retryCount = 0; const fetchWithRetry = async () => { try { const response = await fetch(url, modifiedInit); if (!response.ok) { if (response.status === 429) { console.warn( `Too Many Requests. Retrying in ${delayTime / 1000} seconds...` ); } throw new Error(`Failed to fetch ${url}: ${response.statusText}`); } return response; } catch (error) { throw new Error(`Fetch error for ${url}: ${error.message}`); } }; return fetchWithRetry(); }, }); };
No response
The text was updated successfully, but these errors were encountered:
set proxy like this , it works.
import {setGlobalDispatcher, ProxyAgent} from 'undici' const proxyh = "http://127.0.0.1:7890"; const socksAgent = new ProxyAgent({uri:proxyh}); setGlobalDispatcher(socksAgent); const fetchTranscript = async ( url: string ): Promise<(string | undefined)[] | undefined> => { const { Innertube } = await import("youtubei.js"); const youtube = await Innertube.create({ lang: "en", location: "US", retrieve_player: false, }); 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; } };
Sorry, something went wrong.
No branches or pull requests
Describe your suggestion
I use proxy, but get error
Error
Line:40 🍷 url https://www.youtube.com/iframe_api
Fetch error for https://www.youtube.com/iframe_api. Retrying in 2 seconds...
Line:40 🍷 url https://www.youtube.com/sw.js_data
Fetch error for https://www.youtube.com/sw.js_data. Retrying in 2 seconds...
Tell me why? Please, Thank you.
Code
Other details
No response
Checklist
The text was updated successfully, but these errors were encountered: