Reference for youtube_dl_scraper/core/youtube.py
¶
youtube_dl_scraper.core.youtube.YouTube
¶
YouTube(video_scraper_name: Optional[str] = 'savetube', caption_scraper_name: Optional[str] = 'downsub', download_path: Optional[str] = 'downloads')
A class for scraping YouTube videos and captions using specified scrapers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
video_scraper_name
|
Optional[str]
|
The name of the video scraper (default is "savetube"). |
'savetube'
|
caption_scraper_name
|
Optional[str]
|
The name of the caption scraper (default is "downsub"). |
'downsub'
|
download_path
|
Optional[str]
|
The directory path where videos and captions will be saved (default is "downloads"). |
'downloads'
|
Source code in youtube_dl_scraper/core/youtube.py
async_scrape_captions
async
¶
Asynchronously scrape captions from the given URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the video for which to scrape captions. |
required |
Returns:
Name | Type | Description |
---|---|---|
CaptionArray |
CaptionArray
|
A CaptionArray object containing the scraped captions. |
Raises:
Type | Description |
---|---|
ScraperExecutionError
|
If an error occurs while scraping captions. |
Source code in youtube_dl_scraper/core/youtube.py
async_scrape_video
async
¶
Asynchronously scrape video data from the given URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the video to scrape. |
required |
Returns:
Name | Type | Description |
---|---|---|
Video |
Video
|
A Video object containing the scraped video data. |
Raises:
Type | Description |
---|---|
ScraperExecutionError
|
If an error occurs while scraping the video. |
Source code in youtube_dl_scraper/core/youtube.py
scrape_captions
¶
Synchronously scrape captions from the given URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the video for which to scrape captions. |
required |
Returns:
Name | Type | Description |
---|---|---|
CaptionArray |
CaptionArray
|
A CaptionArray object containing the scraped captions. |
Raises:
Type | Description |
---|---|
ScraperExecutionError
|
If an error occurs while scraping captions. |
Source code in youtube_dl_scraper/core/youtube.py
scrape_video
¶
Synchronously scrape video data from the given URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the video to scrape. |
required |
Returns:
Name | Type | Description |
---|---|---|
Video |
Video
|
A Video object containing the scraped video data. |
Raises:
Type | Description |
---|---|
ScraperExecutionError
|
If an error occurs while scraping the video. |