Repository: yt-dlp/yt-dlp

Issue:
[Site Feature Request] [Funimation] Download English Subtitle File For Japanese Audio
## Checklist

- [x] I'm reporting a broken site support issue
- [x] I've verified that I'm running yt-dlp version **2021.06.09**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [x] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [x] I've searched the bugtracker for similar bug reports including closed ones
- [x] I've read bugs section in FAQ


## Verbose log

```
[debug] Command-line config: ['-N', '12', '--add-metadata', '--all-subs', '--cookies', '../cookies/funi/cookies.txt', '-o', '%(title)s.%(ext)s', '-v', '--list-subs', 'https://www.funimation.com/en/shows/baka-test-summon-the-beasts-/idiots-classes-and-the-summoner-test-war/?lang=japanese']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.06.08 
[debug] Python version 3.9.5 (CPython 64bit) - Linux-5.12.10-zen1-1-zen-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Proxy map: {}
[debug] [Funimation] Extracting URL: https://www.funimation.com/en/shows/baka-test-summon-the-beasts-/idiots-classes-and-the-summoner-test-war/?lang=japanese
[Funimation] idiots-classes-and-the-summoner-test-war: Downloading webpage
[Funimation] 46090: Downloading JSON metadata
[Funimation] 46090: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
46090 has no subtitles
```

## Description

Given that "animelab is becoming Funimation" (making this issue redundant in the coming weeks/months: https://github.com/yt-dlp/yt-dlp/issues/347), I've decided to try using the Funimation extractor, which works well for the most part, however I've encountered an issue where it fails to detect or download subtitles despite the subtitles clearly being displayed on the player. This is the same issue I faced with HiDive: https://github.com/yt-dlp/yt-dlp/issues/408

Funimation doesn't detect any subtitles when asked to `--list-subs`, and none of the other subtitle options produce any subtitles. Supposedly, this has been fixed in a pull request that hasn't been merged with youtube-dl's codebase here: https://github.com/ytdl-org/youtube-dl/issues/25645

This is the link to the repository, which was last updated 29 days ago: https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-fixes

I believe it fixes the subtitle issue, but likely also other issues. I believe it also adds support for downloading entire shows.

To test this issue, you must have a Funimation account, which is free to create, and you should be able to watch most, if not all shows for free. This is the URL I used as an example: https://www.funimation.com/en/shows/baka-test-summon-the-beasts-/idiots-classes-and-the-summoner-test-war/?lang=japanese

Funimation works predominantly in the United States, though it is possible to access from other countries, such as Australia.

## Other Issue - Downloads English Dub by Default

This issue likely only applies to premium members, as they are the only ones who have access to the English dub versions of series, I believe. This also only applies to series with both English dub and Japanese dub versions. I don't know where I came across it, but the solution is to append `lang=japanese` or `lang=english` to the end of the URL depending on what you want. I attempted to solve this issue by changing the preferences for my profile, but no such luck. This is the only thing I've tried that works - and it works great.


Discussion:
Can't you just do something like this if you prefer Japanese? https://github.com/yt-dlp/yt-dlp/issues/347#issuecomment-848559100 I haven't checked if that works for Funimation but you could probably just solve it through a filter.

As for the subtitles, I haven't seen any in a long time but wasn't sure if that was just because they are hardsubbed now?
> Can't you just do something like this if you prefer Japanese? [#347 (comment)](https://github.com/yt-dlp/yt-dlp/issues/347#issuecomment-848559100) I haven't checked if that works for Funimation but you could probably just solve it through a filter.
> I haven't seen any subtitles on Funimation videos in a long time, I think they are all hardsubbed now?

Unfortunately not. See the results when passing the `-F` option on the base link https://www.funimation.com/en/shows/baka-test-summon-the-beasts-/idiots-classes-and-the-summoner-test-war/:

```
[info] Available formats for 93567:
ID        EXT RESOLUTION |   TBR  PROTO  | VCODEC        VBR  ACODEC     ABR
--------- --- ---------- - ------ ------ - ----------- ------ --------- ----
mp4       mp4 unknown    |        https  | unknown            unknown   
hls-542   mp4 416x234    |  542k  m3u8_n | avc1.66.30   542k  mp4a.40.2   0k
hls-780   mp4 480x270    |  780k  m3u8_n | avc1.66.30   780k  mp4a.40.2   0k
hls-1026  mp4 640x360    | 1026k  m3u8_n | avc1.66.30  1026k  mp4a.40.2   0k
hls-1752  mp4 640x360    | 1752k  m3u8_n | avc1.42001f 1752k  mp4a.40.2   0k
hls-2396  mp4 960x540    | 2396k  m3u8_n | avc1.4d001f 2396k  mp4a.40.2   0k
hls-3107  mp4 1280x720   | 3107k  m3u8_n | avc1.4d001f 3107k  mp4a.40.2   0k
hls-4450  mp4 1280x720   | 4450k  m3u8_n | avc1.4d001f 4450k  mp4a.40.2   0k
hls-6256  mp4 1440x810   | 6256k  m3u8_n | avc1.640028 6256k  mp4a.40.2   0k
hls-8249  mp4 1920x1080  | 8249k  m3u8_n | avc1.640028 8249k  mp4a.40.2   0k
```

It only lists options for the English version.

The videos aren't hardsubbed. When downloading the Japanese version, no subtitles are in the video.

Additionally, in preferences, you can set subtitle options, such as small, medium or large font size, font color from 7 different colors, and you can set a background. There's no way they have over 40 different videos that contain all of those different configurations for each episode.
> The videos aren't hardsubbed. When downloading the Japanese version, no subtitles are in the video.
> 
> Additionally, in preferences, you can set subtitle options, such as small, medium or large font size, font color from 7 different colors, and you can set a background. There's no way they have over 40 different videos that contain all of those different configurations for each episode.

Oh I see... When I download English dubbed they seem to be hardsubbed though for stuff like signs/song translations ect.
I noticed your -v log doesn't show that it's logging you in whereas mine does (I use netrc and cookies) and I have an extra format hls-10176 for that file, I'm testing that now. EDIT: It's still English...
> > The videos aren't hardsubbed. When downloading the Japanese version, no subtitles are in the video.
> > Additionally, in preferences, you can set subtitle options, such as small, medium or large font size, font color from 7 different colors, and you can set a background. There's no way they have over 40 different videos that contain all of those different configurations for each episode.
> 
> Oh I see... When I download English dubbed they seem to be hardsubbed though for stuff like signs/song translations ect.
> I noticed your -v log doesn't show that it's logging you in whereas mine does (I use netrc and cookies) and I have an extra format hls-10176 for that file, I'm testing that now. EDIT: It's still English...

I believe on the English dub, the subtitles for signage etc. are burned in, but I think you can also add closed captions, which you can adjust.

I'm not sure what `.netrc` is and how it relates, but I use a Firefox extension called "cookies.txt" and pass the cookies to `yt-dlp` using the resulting cookies file for Animelab, HiDive, Crunchyroll, and Funimation. And yes, strangely enough, it doesn't show me logging into Funimation, though I know it does for Animelab (and likely HiDive too). 
> I'm not sure what `.netrc` is and how it relates, but I use a Firefox extension called "cookies.txt" and pass the cookies to `yt-dlp` using the resulting cookies file for Animelab, HiDive, Crunchyroll, and Funimation. And yes, strangely enough, it doesn't show me logging into Funimation, though I know it does for Animelab (and likely HiDive too).

The netrc is a file where you can store your usernames and passwords for each extractor which you can then just add -n to the commandline for it to automatically log you in.
As for the Funimation extractor, it looks like it needs quite a bit of improving. I was looking to find ways to append extra text to the url without having to type it out every time but it looks like there's no way to do it in Yt-Dlp yet? I was actually looking to try and get Funimation to prefer uncut downloads but it keeps defaulting to simulcast (tbf even the shitty website does that...).
> > I'm not sure what `.netrc` is and how it relates, but I use a Firefox extension called "cookies.txt" and pass the cookies to `yt-dlp` using the resulting cookies file for Animelab, HiDive, Crunchyroll, and Funimation. And yes, strangely enough, it doesn't show me logging into Funimation, though I know it does for Animelab (and likely HiDive too).
> 
> The netrc is a file where you can store your usernames and passwords for each extractor which you can then just add -n to the commandline for it to automatically log you in.
> As for the Funimation extractor, it looks like it needs quite a bit of improving. I was looking to find ways to append extra text to the url without having to type it out every time but it looks like there's no way to do it in Yt-Dlp yet? I was actually looking to try and get Funimation to prefer uncut downloads but it keeps defaulting to simulcast (tbf even the shitty website does that...).

Ah, I see. I find cookies tend to work well for me, so I think I'll stick with that.

The Funimation extractor has already been significantly improved in this repository: https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-fixes

It should fix some of the issues we've been facing (it's 4 months ahead of the version being used in the main `youtube-dl` codebase, and a similar period of time for yt-dlp). The lack of English subtitles doesn't bother me that much, and I've found a fix for using the Japanese stream, so I'll be sticking with yt-dlp for now, but it might be worth attempting to build that `funimation-fixes` branch to test out how it works and what it fixes.
> The Funimation extractor has already been significantly improved in this repository: https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-fixes
> 
> It should fix some of the issues we've been facing (it's 4 months ahead of the version being used in the main `youtube-dl` codebase, and a similar period of time for yt-dlp). The lack of English subtitles doesn't bother me that much, and I've found a fix for using the Japanese stream, so I'll be sticking with yt-dlp for now, but it might be worth attempting to build that `funimation-fixes` branch to test out how it works and what it fixes.

I created a fork of yt-dlp with those changes: https://github.com/Jules-A/yt-dlp/tree/fun will test it when I get some time but I'm mainly interested in dubs so the subtitles aren't really important for me (since the hardcoded ones seem to work fine). 
@LunaGNUisance Those fixes didn't fix the absolute stupidity of Funimation unfortunately. I have Funimation settings to prefer English Dubbed and trying to download (and actually just watching on the website) defaults to dubs for Ep.1/2 but after that it downloads Japanese audio... It downloads English CC subtitles on the English dub and MPV plays them by default with 
`sub-auto=fuzzy
slang=en,enUS`
Meaning I have to disable them when watching (they show as `Language                    : English
Default                     : Yes
Forced                      : No
Alternate group             : 3` )

The log looks like this: 
```
[debug] [Funimation] Extracting URL: https://www.funimation.com/en/shows/noragami/snow-like#2
[Funimation] snow-like: Downloading webpage
[Funimation] snow-like: Downloading webpage
[Funimation] 20196: Downloading JSON metadata
[Funimation] 20196: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: en
[debug] Searching for r"\#(?P<myindex>.+)" in %(original_url)s
[MetadataFromField] parsed myindex from "original_url": 2
[debug] Searching for r"^(?P<title>.+ - S\d+E\d+ - \S+.*)$" in %(series)s - S%(season_number)sE%(episode_number)s - %(episode)s
[MetadataFromField] parsed title from "%(series)s - S%(season_number)sE%(episode_number)s - %(episode)s": Noragami - S1E2 - Snow-like
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 20196: Downloading 1 format(s): hls-10010
[info] Writing video subtitles to: D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.en.srt
[debug] Invoking downloader on "https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1291900/English/1291900_English_dcc6abe2-1ea8-e911-82a8-dd291e252010.srt"
[download] Destination: D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.en.srt
[download] 100% of 28.75KiB in 00:00
[debug] Invoking downloader on "https://vmfst-api.prd.funimationsvc.com/FunimationStoreFront/1291900/English/1291900_English_d4c6abe2-1ea8-e911-82a8-dd291e252010_Layer10.m3u8?Key-Pair-Id=APKAIHNXECY27H4O6NIA&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9kMzNldDc3ZXZkOWJnZy5jbG91ZGZyb250Lm5ldC9GdW5pbWF0aW9uU3RvcmVGcm9udC8xMjkxOTAwL0VuZ2xpc2gvKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTYyNDI5ODQyMn19fV19&Signature=YprflmkuUgfck910CeApBush40iuZXC188jbNgyr82jze96JflKC0fLSIgsNtS4Bcp15xUeRk~WtwrDLgCv~JzOvpwErxwEkJX7a3HMhnxdlJrNsnlKF369A1YluNs30wuEGQbQDJ8KOqAxM6vl7ljBBBlEMXvvFe6tajNWlSj~lLtHSGVMHrhJvoDvuAIRbBYskW-Pa-TzOrVLvVExq0sxLFRUTOfcNE7tEMZBO4VZaxJrBmhydO4Ov-JfT8Lfj2dWdEcYj93KdFhsRIDuIV~i71GpsYdNucAfDxvfn3HXW0djc9JrFvLdUqx1Sbtt5z2BNSwHJlki8M0e4LFvQ0Q__&rt=1474552"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 185
[download] Destination: D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4
WARNING: The download speed shown is only of one thread. This is a known issue
[download] 100% of 1.42GiB in 03:59
[debug] ffmpeg command line: ffprobe -show_streams "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4"
[FixupM3u8] Fixing malformed AAC bitstream of "D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4" -c copy -map 0 -dn -f mp4 "-bsf:a" aac_adtstoasc "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.temp.mp4"
[EmbedSubtitle] Embedding subtitles in "D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4" -i "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.en.srt" -c copy -map 0 -dn -map "-0:s" -map "-0:d" "-c:s" mov_text -map "1:0" "-metadata:s:s:0" "language=eng" "file:D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.temp.mp4"
Deleting original file D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.en.srt (pass -k to keep)
[MoveFiles] Moving file "D:\Temp\Funimation\Noragami - S1E2 - Snow-like - 2.mp4" to "D:\Programs\YoutubeDL\Funimation\Noragami - S1E2 - Snow-like - 2.mp4"
[debug] [Funimation] Extracting URL: https://www.funimation.com/en/shows/noragami/bidden-calamity#3
[Funimation] bidden-calamity: Downloading webpage
[Funimation] bidden-calamity: Downloading webpage
[Funimation] 20037: Downloading JSON metadata
[Funimation] 20037: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: en
[debug] Searching for r"\#(?P<myindex>.+)" in %(original_url)s
[MetadataFromField] parsed myindex from "original_url": 3
[debug] Searching for r"^(?P<title>.+ - S\d+E\d+ - \S+.*)$" in %(series)s - S%(season_number)sE%(episode_number)s - %(episode)s
[MetadataFromField] parsed title from "%(series)s - S%(season_number)sE%(episode_number)s - %(episode)s": Noragami - S1E3 - Bidden Calamity
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 20037: Downloading 1 format(s): hls-9977
[info] Writing video subtitles to: D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.en.srt
[debug] Invoking downloader on "https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1291902/Japanese/1291902_Japanese_34937525-b778-4f06-b05b-517e9c5256b0.srt"
[download] Destination: D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.en.srt
[download] 100% of 25.28KiB in 00:00
[debug] Invoking downloader on "https://vmfst-api.prd.funimationsvc.com/FunimationStoreFront/1291902/Japanese/1291902_Japanese_7478010_c88b6d7a-c897-e511-818b-0017a4776c04_Layer10.m3u8?Key-Pair-Id=APKAIHNXECY27H4O6NIA&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9kMzNldDc3ZXZkOWJnZy5jbG91ZGZyb250Lm5ldC9GdW5pbWF0aW9uU3RvcmVGcm9udC8xMjkxOTAyL0phcGFuZXNlLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2MjQyOTg3MzN9fX1dfQ__&Signature=k2NIKA2IHRiIdzPvu27SNGesa-hoslX6vugw1NtxL8kAdrTLe8Pk4MH5mIY5Pp7Yv~FS73Be~d9OZJ5fOUcP7uyvMmce0YzuukHd6WTxttf7G2Q1IG-s3MdrxGod0RR6UE7AbIno8Wjz~sayahrsbPJYAyGOa6PA~W5uAEWKevSLpuFa6ubIJNHBWtMwfzFlHfqw73aj7gOC5DHSf~gW896ttZufTBaj6JAFKxq2M~QIDdo2YTp1fmw1fR9RmbCUUEczQ8TVK0xPCLhDW5sp2vgvC~oXGSge6HLuiO5YitRkKBq4DlgiOuLP2WKFzivbrf-MTeLenI~EO0UQdoahsQ__&rt=1474552"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 185
[download] Destination: D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4
WARNING: The download speed shown is only of one thread. This is a known issue
[download] 100% of 1.41GiB in 04:25
[debug] ffmpeg command line: ffprobe -show_streams "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4"
[FixupM3u8] Fixing malformed AAC bitstream of "D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4" -c copy -map 0 -dn -f mp4 "-bsf:a" aac_adtstoasc "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.temp.mp4"
[EmbedSubtitle] Embedding subtitles in "D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4" -i "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.en.srt" -c copy -map 0 -dn -map "-0:s" -map "-0:d" "-c:s" mov_text -map "1:0" "-metadata:s:s:0" "language=eng" "file:D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.temp.mp4"
Deleting original file D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.en.srt (pass -k to keep)
[MoveFiles] Moving file "D:\Temp\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4" to "D:\Programs\YoutubeDL\Funimation\Noragami - S1E3 - Bidden Calamity - 3.mp4"

```

CmdL: `yt-dlp -v -a "ToDownload - norigami.txt" -o "%%(extractor)s\%%(title)s - %%(myindex)s.%%(ext)s" --parse-metadata "original_url:#%%(myindex)s" --parse-metadata "%%(series)s - S%%(season_number)sE%%(episode_number)s - %%(episode)s:^(?P<title>.+ - S\d+E\d+ - \S+.*)$" --cookies cookies-funimation-com.txt --output-na-placeholder "" --embed-subs --sub-langs en,enUS --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0" -n --fragment-retries "infinite" -N 3 --no-mtime --download-archive archive.txt -P temp:D:\Temp\`


On the Japanese audio ones it downloaded it did use normal English subs and not CC so I guess it works for that. Technically if I want dubs I don't need subtitles so I could just remove the embed subs but that would mean I'd be further away from having a generic command so it would be nice if it could be fixed... 

I think I might need help from @pukkandan to help fix this mess :( 

Also, unlike Luna, adding lang=english doesn't work, I just get a 
>Sorry, this video is not available.

message yet I can switch to English from the controls fine...

EDIT: Playlist doesn't work either: 

```[funimation:playlist] Logging in
[debug] [funimation:playlist] Extracting URL: https://www.funimation.com/shows/noragami/
[funimation:playlist] noragami: Downloading webpage
WARNING: [funimation:playlist] noragami: Failed to parse JSON Expecting value: line 1 column 1 (char 0)
[funimation:playlist] noragami: Downloading JSON metadata
[download] Downloading playlist: None
[funimation:playlist] playlist None: Collected 0 videos; downloading 0 of them
[download] Finished downloading playlist: None```
Please don't mix various issues. I have split the dub/sub issue into #428. 

From what I understand from this discussion, @Jules-A  has tested @Mevious's PR https://github.com/ytdl-org/youtube-dl/pull/24906 to be working, correct? If so, open a PR here with it and I will merge it asap. Otherwise I will test it later

For playlist support, open a new issue, or even better a PR
> For playlist support, open a new issue, or even better a PR

~I have a separate playlist PR at https://github.com/ytdl-org/youtube-dl/pull/28951~
Edit: I just realized yt-dlp is a fork of yt-dp, not the original. Not sure if you can directly merge that in or I would need to make a new one. Let me know.


> EDIT: Playlist doesn't work either:

```
[debug] [funimation:playlist] Extracting URL: https://www.funimation.com/shows/noragami/
[funimation:playlist] noragami: Downloading webpage
WARNING: [funimation:playlist] noragami: Failed to parse JSON Expecting value: line 1 column 1 (char 0)
[funimation:playlist] noragami: Downloading JSON metadata
[download] Downloading playlist: None
[funimation:playlist] playlist None: Collected 0 videos; downloading 0 of them
[download] Finished downloading playlist: None
```

I was only ever able to get any download working by appending "/en/" in the url after the ".com" see the discussions on https://github.com/ytdl-org/youtube-dl/pull/28950 and https://github.com/ytdl-org/youtube-dl/pull/28951
I would love some clarification on that issue.
> 
> 
> Please don't mix various issues. I have split the dub/sub issue into #428.
> 
> From what I understand from this discussion, @Jules-A has tested @Mevious's PR [ytdl-org/youtube-dl#24906](https://github.com/ytdl-org/youtube-dl/pull/24906) to be working, correct? If so, open a PR here with it and I will merge it asap. Otherwise I will test it later
> 
> For playlist support, open a new issue, or even better a PR

Ah okay. As for Mervious's changes, it works for Japanese audio but I think it needs to be modified to not download English CC for English dubbed content imo. Playlist support was part of the changes which is why I also tested it but it wasn't working.

EDIT: @Mevious I tested https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-fixes which looks to have included all the playlist code from that branch?
> EDIT: @Mevious I tested https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-fixes which looks to have included all the playlist code from that branch?

Yes, this branch should include all my updates. I also have the branch [funimation-playlist](https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-playlist) with only the playlist changes. Feel free to copy any or all of this to new PRs or let me know if I can do anything to help.
> I also have the branch [funimation-playlist](https://github.com/Mevious/youtube-dl-1/tree/mevious/funimation-playlist) with only the playlist changes. Feel free to copy any or all of this to new PRs or let me know if I can do anything to help.

I will test playlist stuff later, this issue is about the subtitles so if you don't mind could you maybe omit the English CC subtitles for English dubbed content as I mentioned earlier or maybe give your opinion on them being downloaded with embed subtitles? I'm talking about the subtitles that are on constantly and include stuff like [yelling loudly] meant for deaf people. I want to keep --embed-subs in my cmdl (since I will also download some JP stuff) but don't want those subs or at least I don't want them to be enabled by default when I'm playing in MPV (if there's another way around it)?
If we can already extract a set of subs, it should not be purposely left out. Instead, the extractor will need to make sure that the CC and normal subs register with different keys (they need not be language codes) so that user can select one or the other with `--sub-lang`
Luckily these are labeled as "CC" or "Full" so we _could_ differentiate between closed caption and subtitles if necessary. Here are examples taken from the dub and sub of an episode:
```
{u'src': u'https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1867145/English/1867145_English_a9d3fd01-00fe-ea11-82a8-dd291e252010.srt', u'kind': u'subtitle', u'type': u'CC', u'language': u'en', u'label': u'English'}
{u'src': u'https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1867145/Japanese/1867145_Japanese_bf086a99-7010-44bd-9789-fc522b405e76.srt', u'kind': u'subtitle', u'type': u'Full', u'language': u'en', u'label': u'English'}
```
I'm not completely convinced they _should_ be differentiated. I haven't found an example where a single video has both. It always seems to be "Full" for the sub and "CC" for the dub. Is the expectation to make the language "en_cc" and "en_full" for these? What should be the default? I'm having trouble finding an example of this with another extractor. Could anyone provide one?
I think the only problem is English CC on English dub. I don't know about videos with other languages such as Spanish ect. Idk about pukkudan's opinion but would making them enCC be bad? I just don't know about underscores.

Resolving patch:
diff --git a/yt_dlp/extractor/funimation.py b/yt_dlp/extractor/funimation.py
--- a/yt_dlp/extractor/funimation.py
+++ b/yt_dlp/extractor/funimation.py
@@ -10,8 +10,9 @@
     determine_ext,
     int_or_none,
     js_to_json,
+    urlencode_postdata,
+    urljoin,
     ExtractorError,
-    urlencode_postdata
 )
 
 
@@ -109,6 +110,7 @@ def _search_kane(name):
         if series:
             title = '%s - %s' % (series, title)
         description = self._html_search_meta(['description', 'og:description'], webpage, fatal=True)
+        subtitles = self.extract_subtitles(url, video_id, display_id)
 
         try:
             headers = {}
@@ -153,6 +155,24 @@ def _search_kane(name):
             'season_number': int_or_none(title_data.get('seasonNum') or _search_kane('season')),
             'episode_number': int_or_none(title_data.get('episodeNum')),
             'episode': episode,
+            'subtitles': subtitles,
             'season_id': title_data.get('seriesId'),
             'formats': formats,
         }
+
+    def _get_subtitles(self, url, video_id, display_id):
+        player_url = urljoin(url, '/player/' + video_id)
+        player_page = self._download_webpage(player_url, display_id)
+        text_tracks_json_string = self._search_regex(
+            r'"textTracks": (\[{.+?}\])',
+            player_page, 'subtitles data', default='')
+        text_tracks = self._parse_json(
+            text_tracks_json_string, display_id, js_to_json, fatal=False) or []
+        subtitles = {}
+        for text_track in text_tracks:
+            url_element = {'url': text_track.get('src')}
+            language = text_track.get('language')
+            if text_track.get('type') == 'CC':
+                language += '_CC'
+            subtitles.setdefault(language, []).append(url_element)
+        return subtitles


Test patch: