Comments (10)
You can extract them it's just that you can't directly.
To explain it clearly: Youtube only provides some subtitles tracks by default (those uploaded by the user and autogenerated ones, iirc they are in the language of the video), the translation of the tracks is not available right away and you need to generate their url with the code I posted before:
var manifest = await yt.videos.closedCaptions.getManifest('WOxr2dmLHLo');
var trackInfo = manifest.getByLanguage('en', autoGenerate: false, format: ClosedCaptionFormat.srv3); // Or manifest.tracks.first if you just want to get an available track.
if (trackInfo != null) {
var subtitles = await yt.videos.closedCaptions.getSubTitles(trackInfo.autoTranslate('vi'));
}
PS: I'm only now noticing that I posted the wrong code in the previous comment, sorry
from youtube_explode_dart.
Fetching auto-translated closed captions is not yet support, I'm planning to implement it in the coming days
from youtube_explode_dart.
This was implemented see the unit tests to have an idea on how to implement this:
youtube_explode_dart/test/closed_caption_test.dart
Lines 14 to 52 in a9275af
from youtube_explode_dart.
Hello, thanks for this. The auto-generated
works fine, but the auto-translate
is not working. Hope it's supported in the near future.
from youtube_explode_dart.
Seems like youtube implement some changes recently now the request must include some kind of specific query parameter, I'll look into this when I have time
from youtube_explode_dart.
It now should be fixed please read the changelog and try again
from youtube_explode_dart.
Hello, thanks for the update. But it's still not working with auto-translate
track. For ex, I tried the following test and got the null
result:
var manifest = await yt.videos.closedCaptions.getManifest('WOxr2dmLHLo');
var trackInfo = manifest.tracks.firstWhere((element) => element.language.code == 'vi', orElse: () => null);
if (trackInfo != null) {
var subtitles = await yt.videos.closedCaptions.getSubTitles(trackInfo);
}
I got null
value for trackInfo
. But as you can see in the attached image, the video has Vietnamese (vi
) auto-translate track:
from youtube_explode_dart.
Youtube does not provide autotranslated tracks by default you first need to get a track provided by youtube, and then autotranslate it:
var manifest = await yt.videos.closedCaptions.getManifest('WOxr2dmLHLo');
var trackInfo = manifest.getByLanguage('en', autoGenerate: false, format: ClosedCaptionFormat.srv3); // Or manifest.tracks.first if you just want to get an available track.
if (trackInfo != null) {
var subtitles = await yt.videos.closedCaptions.getSubTitles(trackInfo);
}
from youtube_explode_dart.
@Hexer10 Does that mean youtube_explode_dart
cannot extract the auto-translate track? I think it should be possible because I see Youtube-dl
can extract it.
from youtube_explode_dart.
@Hexer10 Awesome. Finally I'm able to get the auto-translate CC thanks to your code. Thank you very much. Please keep evolving this plugin as you guys are doing amazing job. ๐ฅ
from youtube_explode_dart.
Related Issues (20)
- [BUG] Working with playlist with more than 120 videos HOT 4
- it give me status 403 error [BUG] HOT 1
- When downloading larger videos, the program is prone to blocking the main thread, resulting in program unresponsiveness.[BUG] HOT 4
- How to download member-only videos HOT 2
- [BUG] Getting error in fetching Channel videos HOT 3
- [BUG] issue implementing pagination using the .nextPage() method HOT 1
- It is recommended to add the authorโs avatar
- Youtube shorts only filter HOT 1
- getCaptionTracks() is not working HOT 1
- [BUG] VideoUnavailableException even though the video is available on youtube HOT 2
- [BUG] closedCaptions client does not work consistently
- Language metadata for audio track HOT 1
- Related videos HOT 1
- VideoSearchList is randomly empty instead of returning a list of 20 HOT 2
- [BUG] Can't retreive comment of any video HOT 1
- srt format.
- [BUG] Can't retrieve 720p quality in any video HOT 9
- got this error today while downloading youtube video HOT 2
- Add/Expose loudnessDb for audio-only streams
- Fetching multiple videos with videoIDs at once
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtube_explode_dart.