YouTube.js icon indicating copy to clipboard operation
YouTube.js copied to clipboard

youtube rate limited my server

Open nikunjmishra1998 opened this issue 1 year ago • 7 comments

Question

Sometimes youtube stops to give a response to my server, I mean youtube blocking my server (by ip address), So is there any option to avoid server blocking by youtube.

Other details

I am using ubuntu 22.01 with node version 20.11.1

Checklist

  • [X] I am running the latest version.
  • [X] I checked the documentation and found no answer.
  • [X] I have searched the existing issues and made sure this is not a duplicate.
  • [X] I have provided sufficient information.

nikunjmishra1998 avatar Feb 28 '24 05:02 nikunjmishra1998

you have to use your own solution, here are a few ideas:

  • add rate limiting middleware on your server
  • use proxies (look at this example folder)
  • use a debouncing function (i.e. space out the requests so they dont go brrr)

hope it helps!

gnosticdev avatar Feb 28 '24 23:02 gnosticdev

@gnosticdev can you please provide any examples or reference to use debouncing functions?

nikunjmishra1998 avatar Mar 01 '24 04:03 nikunjmishra1998

@gnosticdev can we use proxies with GetBasicInfo() function?

Or any examples to use proxies while creating InnnerTube Client without fetch in node Js?

nikunjmishra1998 avatar Mar 01 '24 05:03 nikunjmishra1998

Yes you can proxy anything. Go to the link I provided to see an example.

Denouncing could be just a simple setTimeout to add some delay to each request, but depends how many you have and might need more detailed approach.

If you don't know how these work, then just use a vpn on your host machine.

There's a lot of useful stuff in the examples folder in this repo. I would start there.

gnosticdev avatar Mar 01 '24 05:03 gnosticdev

@gnosticdev I see that title='Video Not Available' and author= 'YouTube Viewers' in the result of GetBasicInfo() for every youtube video, So is there any specific reason for this issue?

strange thing is the same code on my local system giving perfect data with original title and author but on the server I am receiving below data.

VideoInfo { streaming_data: { expires: 2024-03-01T12:04:27.810Z, formats: [ [Format], [Format] ], adaptive_formats: [ [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format], [Format] ], dash_manifest_url: null, hls_manifest_url: null }, playability_status: { status: 'OK', reason: '', embeddable: true, audio_only_playablility: null, error_screen: null }, player_config: { audio_config: { loudness_db: -9986, perceptual_loudness_db: -10000, enable_per_format_loudness: true }, stream_selection_config: { max_bitrate: '0' }, media_common_config: { dynamic_readahead_config: [Object] } }, basic_info: { id: 'M5t4UHllkUM', channel_id: 'UCMDQxm7cUx3yXkfeHa5zJIQ', title: 'Video Not Available', duration: 93, keywords: [ 'tips', 'tricks', 'help', 'tutorial', 'youtube', 'youtubehelp', 'support', 'how to' ], is_owner_viewing: false, short_description: '', thumbnail: [ [Thumbnail], [Thumbnail], [Thumbnail], [Thumbnail], [Thumbnail] ], allow_ratings: false, view_count: NaN, author: 'YouTube Viewers', is_private: false, is_live: false, is_live_content: false, is_live_dvr_enabled: false, is_low_latency_live_stream: false, is_upcoming: false, is_post_live_dvr: false, is_crawlable: false, live_chunk_readahead: undefined, embed: null, channel: null, is_unlisted: undefined, is_family_safe: undefined, category: null, has_ypc_metadata: null, start_timestamp: null, end_timestamp: null, like_count: undefined, is_liked: undefined, is_disliked: undefined }, annotations: undefined, storyboards: undefined, endscreen: undefined, captions: undefined, cards: undefined }

nikunjmishra1998 avatar Mar 01 '24 06:03 nikunjmishra1998

@nikunjmishra1998 That means your server is blocked by YouTube for making too many requests in a short space of time, so they return that video instead of the one you actually requested.

absidue avatar Mar 01 '24 06:03 absidue

Okay, So @absidue is there any way to unblock or any other way without changing my current server?

nikunjmishra1998 avatar Mar 01 '24 06:03 nikunjmishra1998

@gnosticdev Do we have any example of proxy implemented with GetBasicInfo() method? Can you please provide any example?

nikunjmishra1998 avatar Mar 06 '24 04:03 nikunjmishra1998

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 06 '24 02:05 github-actions[bot]