File size: 651 Bytes
7288748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from typing import Dict, List, Optional, Tuple

from pydantic import BaseModel

class YoutubeVideo(BaseModel):
    """This class represent a YouTube video entry
    """
    channel_name: str
    url: str
    title: Optional[str]
    description: Optional[str]
    transcription: Optional[str]
    segments: Optional[List[Dict]] = None
    
    def to_tuple(self) -> Tuple:
        """Convert TranscribedVideo object to a tuple of the type:
        (channel_name, url, title, description, transcription, segments).
        """
        return (self.channel_name, self.url, self.title,
                self.description, self.transcription, self.segments)