f-person/youtube_caption_scraper
一個用於從 YouTube 解析字幕/字幕的 Dart 套件
- Stars
- 19
- Forks
- 4
- 最近推送(UTC)
- 2026年3月28日
- 專案狀態
- 未封存
語言Dart
技術主題
使用的依賴
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
展開 / 收合專案 README
A Dart package that parses lyrics from YouTube. No authentication is required.
Usage
// Instantiate the scraper.
final captionScraper = YouTubeCaptionScraper();
// Fetch caption tracks – these are objects containing info like
// base url for the caption track and language code.
final captionTracks = await captionScraper.getCaptionTracks('video-url');
// Fetch the subtitles by providing it with a `CaptionTrack`
// from `getCaptionTracks`.
final subtitles = await captionScraper.getSubtitles(captionTracks[0]);
// Use the subtitles however you want.
for (final subtitle in subtitles) {
print('${subtitle.start} - ${subtitle.duration} - ${subtitle.text}');
}
For more info see example or check the API reference.
Credits
The package is heavily inspired by algolia/youtube-captions-scraper.