Fix broken YT scraping with YT API #4005
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
resolves #4004
What is in this change?
Use Youtube API https://www.youtube.com/youtubei/v1/get_transcript to get transcript instead of https://www.youtube.com/ptracking from youtube scripts. For unknown reason, https://www.youtube.com/ptracking returns empty content for xml transcript and causes current yt scraping fails.
Additional Information
As Youtube API has rate limit, scraping may fails after reaching api limit. For long term solution, it's better to offload ty scraping to npm package youtubei like https://github.com/LuanRT/YouTube.js/blob/main/examples/transcript/index.ts.
Developer Validations
yarn lint
from the root of the repo & committed changes