[PR #4442] [MERGED] fix: youtube transcript collector not work well with non en or non asr caption #4628

Closed
opened 2026-02-22 18:36:13 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4442
Author: @AoiYamada
Created: 9/27/2025
Status: Merged
Merged: 9/29/2025
Merged by: @timothycarambat

Base: masterHead: fix/1770-youtube-transcript-with-non-en-or-non-asr-language


📝 Commits (4)

  • 6839df6 fix: youtube transcript collector not work well with non en or non asr caption
  • dcd92da Merge branch 'master' into fix/1770-youtube-transcript-with-non-en-or-non-asr-language
  • 6e4da8c stub YT test in Github actions
  • 511b102 Merge branch 'fix/1770-youtube-transcript-with-non-en-or-non-asr-language' of github.com:AoiYamada/anything-llm into pr-4442-branch

📊 Changes

2 files changed (+115 additions, -14 deletions)

View changed files

📝 collector/__tests__/utils/extensions/YoutubeTranscript/YoutubeLoader/youtube-transcript.test.js (+27 -11)
📝 collector/utils/extensions/YoutubeTranscript/YoutubeLoader/youtube-transcript.js (+88 -3)

📄 Description

The issue #1770 is a real bug for non asr caption or non en caption because the values are hardcoded.

For example:
https://www.youtube.com/watch?v=D111ao6wWH0

this video has a "zh-HK" language caption with empty string caption kind "" instead of "asr".

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #1770

What is in this change?

Get the caption info of the YouTube video, analyze the track info, and select the preferred transcript info as params to fetch the transcript.

Additional Information

Before the fix, non asr non en caption causes Transcript segments not found in response error:

螢幕截圖 2025-09-27 下午11 13 21

After the fix, transcript could be fetched:

螢幕截圖 2025-09-27 下午11 14 44

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4442 **Author:** [@AoiYamada](https://github.com/AoiYamada) **Created:** 9/27/2025 **Status:** ✅ Merged **Merged:** 9/29/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `fix/1770-youtube-transcript-with-non-en-or-non-asr-language` --- ### 📝 Commits (4) - [`6839df6`](https://github.com/Mintplex-Labs/anything-llm/commit/6839df63ca45b20b9ce5c21b2aebdba12b3c19e3) fix: youtube transcript collector not work well with non en or non asr caption - [`dcd92da`](https://github.com/Mintplex-Labs/anything-llm/commit/dcd92da6804ba3c3fac51feab88f2d6664ae4939) Merge branch 'master' into fix/1770-youtube-transcript-with-non-en-or-non-asr-language - [`6e4da8c`](https://github.com/Mintplex-Labs/anything-llm/commit/6e4da8cb15c2828f66b2f7a00d05c378e760ed22) stub YT test in Github actions - [`511b102`](https://github.com/Mintplex-Labs/anything-llm/commit/511b102d94b883e56c484be54b5623dfd28f954b) Merge branch 'fix/1770-youtube-transcript-with-non-en-or-non-asr-language' of github.com:AoiYamada/anything-llm into pr-4442-branch ### 📊 Changes **2 files changed** (+115 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `collector/__tests__/utils/extensions/YoutubeTranscript/YoutubeLoader/youtube-transcript.test.js` (+27 -11) 📝 `collector/utils/extensions/YoutubeTranscript/YoutubeLoader/youtube-transcript.js` (+88 -3) </details> ### 📄 Description The issue #1770 is a real bug for non asr caption or non en caption because the values are hardcoded. For example: https://www.youtube.com/watch?v=D111ao6wWH0 this video has a "zh-HK" language caption with empty string caption kind "" instead of "asr". ### Pull Request Type - [ ] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues resolves #1770 ### What is in this change? Get the caption info of the YouTube video, analyze the track info, and select the preferred transcript info as params to fetch the transcript. ### Additional Information Before the fix, non asr non en caption causes `Transcript segments not found in response` error: <img width="1240" height="724" alt="螢幕截圖 2025-09-27 下午11 13 21" src="https://github.com/user-attachments/assets/86198caf-fce2-468b-b76a-c7e061fdcb7b" /> After the fix, transcript could be fetched: <img width="1240" height="724" alt="螢幕截圖 2025-09-27 下午11 14 44" src="https://github.com/user-attachments/assets/a73ade8b-f57d-4b21-b1ba-122f648fbd05" /> ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:13 -05:00
yindo closed this issue 2026-02-22 18:36:13 -05:00
yindo changed title from [PR #4442] fix: youtube transcript collector not work well with non en or non asr caption to [PR #4442] [MERGED] fix: youtube transcript collector not work well with non en or non asr caption 2026-06-05 15:19:31 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4628