separate out format example in readme
This commit is contained in:
parent
393a76ca6a
commit
fdedfff681
13
README.md
13
README.md
|
@ -48,11 +48,12 @@ This will return a list of dictionaries looking somewhat like this:
|
||||||
# ...
|
# ...
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
### Translate transcript
|
||||||
|
|
||||||
You can add the `languages` param if you want to make sure the transcripts are retrieved in your desired language (it defaults to english). You can also add `preserve_formatting=True` if you'd like to keep HTML formatting elements such as `<i>` (italics) and `<b>` (bold).
|
You can add the `languages` param if you want to make sure the transcripts are retrieved in your desired language (it defaults to english).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
YouTubeTranscriptApi.get_transcripts(video_ids, languages=['de', 'en'], preserve_formatting=True)
|
YouTubeTranscriptApi.get_transcripts(video_ids, languages=['de', 'en'])
|
||||||
```
|
```
|
||||||
|
|
||||||
It's a list of language codes in a descending priority. In this example it will first try to fetch the german transcript (`'de'`) and then fetch the english transcript (`'en'`) if it fails to do so. If you want to find out which languages are available first, [have a look at `list_transcripts()`](#list-available-transcripts)
|
It's a list of language codes in a descending priority. In this example it will first try to fetch the german transcript (`'de'`) and then fetch the english transcript (`'en'`) if it fails to do so. If you want to find out which languages are available first, [have a look at `list_transcripts()`](#list-available-transcripts)
|
||||||
|
@ -65,6 +66,14 @@ YouTubeTranscriptApi.get_transcripts(video_ids, languages=['de', 'en'])
|
||||||
|
|
||||||
`languages` also is optional here.
|
`languages` also is optional here.
|
||||||
|
|
||||||
|
### Preserve formatting
|
||||||
|
|
||||||
|
You can also add `preserve_formatting=True` if you'd like to keep HTML formatting elements such as `<i>` (italics) and `<b>` (bold).
|
||||||
|
|
||||||
|
```python
|
||||||
|
YouTubeTranscriptApi.get_transcripts(video_ids, languages=['de', 'en'], preserve_formatting=True)
|
||||||
|
```
|
||||||
|
|
||||||
### List available transcripts
|
### List available transcripts
|
||||||
|
|
||||||
If you want to list all transcripts which are available for a given video you can call:
|
If you want to list all transcripts which are available for a given video you can call:
|
||||||
|
|
Loading…
Reference in New Issue