Represents a fetched transcript. This object is iterable, which allows you to iterate over the transcript snippets.
| 48 | |
| 49 | @dataclass |
| 50 | class FetchedTranscript: |
| 51 | """ |
| 52 | Represents a fetched transcript. This object is iterable, which allows you to |
| 53 | iterate over the transcript snippets. |
| 54 | """ |
| 55 | |
| 56 | snippets: List[FetchedTranscriptSnippet] |
| 57 | video_id: str |
| 58 | language: str |
| 59 | language_code: str |
| 60 | is_generated: bool |
| 61 | |
| 62 | def __iter__(self) -> Iterator[FetchedTranscriptSnippet]: |
| 63 | return iter(self.snippets) |
| 64 | |
| 65 | def __getitem__(self, index) -> FetchedTranscriptSnippet: |
| 66 | return self.snippets[index] |
| 67 | |
| 68 | def __len__(self) -> int: |
| 69 | return len(self.snippets) |
| 70 | |
| 71 | def to_raw_data(self) -> List[Dict]: |
| 72 | return [asdict(snippet) for snippet in self] |
| 73 | |
| 74 | |
| 75 | @dataclass |