Reference for youtube_dl_scraper/utils/format_time.py¶
    Format a duration in seconds to a human-readable string with hours, minutes, and seconds.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| seconds | int | The total duration in seconds. | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| str | str | A formatted string representing the duration in the format "Xh Ym Zs" or "Xm Zs". | 
Source code in youtube_dl_scraper/utils/format_time.py
              
    Parse a duration string in the format of "HH:MM:SS" or "MM:SS" and return a human-readable duration.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| duration_str | str | A duration string, e.g., "02:15:30" or "15:30". | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| str | str | A human-readable string representing the parsed duration, e.g., "2 hours, 15 minutes, 30 seconds". | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If the input duration string is not in a valid format. | 
Source code in youtube_dl_scraper/utils/format_time.py
              
    Convert a duration in seconds to a string representation of a timedelta.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| seconds | int | The total duration in seconds. | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| str | str | A string representation of the timedelta, e.g., "1:15:30". |