Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify subtitles language #7

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ If this fails you can manually input the channel id with the `--channel-id` flag
```bash
python yt_fts.py download "https://www.youtube.com/@TimDillonShow/videos" --channel-id "UC4woSp8ITBoYDmjkukhEhxg"
```
You can specify expected subtitles language
```bash
python yt_fts.py download "https://www.youtube.com/@TimDillonShow/videos" --language de
```

### `list`
Will list all of your downloaded channels
Expand Down
8 changes: 5 additions & 3 deletions yt_fts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def list():
@click.command( help='download [channel url]')
@click.argument('channel_url', required=True)
@click.option('--channel-id', default=None, help='Optional channel id to override the one from the url')
def download(channel_url, channel_id):
@click.option('--language', default="en", help='Language of the subtitles to download')
def download(channel_url, channel_id, language):
if channel_id is None:
channel_id = get_channel_id(channel_url)
if channel_id:
download_channel(channel_id)
download_channel(channel_id, language)
else:
print("Error finding channel id try --channel-id option")

Expand Down Expand Up @@ -74,7 +75,7 @@ def delete(channel_id):



def download_channel(channel_id):
def download_channel(channel_id, language):
print("Downloading channel")
with tempfile.TemporaryDirectory() as tmp_dir:
print('Saving vtt files to', tmp_dir)
Expand All @@ -87,6 +88,7 @@ def download_channel(channel_id):
"--write-auto-sub",
"--convert-subs", "vtt",
"--skip-download",
"--sub-langs", language + ",-live_chat",
TeddyBear06 marked this conversation as resolved.
Show resolved Hide resolved
channel_url
])
add_channel_info(channel_id, channel_name, channel_url)
Expand Down