Reference for youtube_dl_scraper/core/caption_array.py
¶
youtube_dl_scraper.core.caption_array.CaptionArray
¶
A class for managing a collection of captions, including subtitles and translations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
caption_data
|
dict
|
The raw caption data, including subtitles and translations. |
required |
download_path
|
str
|
The directory where captions will be downloaded. |
required |
Source code in youtube_dl_scraper/core/caption_array.py
subtitles
property
¶
Get the list of avaliable subtitles.
Returns:
Type | Description |
---|---|
Tuple[dict, ...]
|
Tuple[dict, ...]: A tuple of avaliable subtitles. |
translations
property
¶
Get the list of avaliable translations.
Returns:
Type | Description |
---|---|
Tuple[dict, ...]
|
Tuple[dict, ...]: A tuple of avaliable translations. |
get_captions_by_lang_code
¶
Get a caption filtered by language code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang_code
|
str
|
The language code to filter the captions by. |
required |
Returns:
Type | Description |
---|---|
Optional[Caption]
|
Optional[Caption]: A Caption object if a matching caption is found, otherwise None. |
Source code in youtube_dl_scraper/core/caption_array.py
get_captions_by_name
¶
Get a list of captions filtered by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to filter the captions by. |
required |
Returns:
Type | Description |
---|---|
List[Caption]
|
List[Caption]: A list of Caption objects matching the specified name. |
Source code in youtube_dl_scraper/core/caption_array.py
get_translated_captions_by_lang_code
¶
Get a translated caption filtered by language code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang_code
|
str
|
The language code to filter the translated captions by. |
required |
Returns:
Type | Description |
---|---|
Optional[Caption]
|
Optional[Caption]: A translated Caption object if a matching caption is found, otherwise None. |
Source code in youtube_dl_scraper/core/caption_array.py
get_translated_captions_by_name
¶
Get a list of translated captions filtered by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to filter the translated captions by. |
required |
Returns:
Type | Description |
---|---|
List[Caption]
|
List[Caption]: A list of translated Caption objects matching the specified name. |