-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalchemy_youtube.py
77 lines (61 loc) · 1.99 KB
/
alchemy_youtube.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Playlist(Base):
__tablename__ = 'playlists'
id = Column(Integer, primary_key=True)
yt_playlist_id = Column(Text)
name = Column(Text)
address = Column(Text)
def __repr__(self):
return f'Playlist {self.name}'
class Video(Base):
__tablename__ = 'videos'
# table control
id = Column(Integer, primary_key=True)
# basic information
yt_video_id = Column(Text)
title = Column(Text)
description = Column(Text)
created_at = Column(DateTime)
# statistics
viewCount = Column(Integer)
likeCount = Column(Integer)
dislikeCount = Column(Integer)
commentCount = Column(Integer)
author = Column(Text)
# caption
has_caption = Column(Boolean)
# twitter management
has_terms = Column(Boolean)
bot_tweeted = Column(Boolean)
def __repr__(self):
return f'Video {self.id}'
class Caption(Base):
__tablename__ = 'captions'
id = Column(Integer, primary_key=True)
video_id = Column(Integer, ForeignKey("videos.id"), nullable="False")
order = Column(Integer)
minute = Column(Integer)
line = Column(Text)
#controle de busca
was_searched = Column(Boolean, default=False)
has_terms = Column(Boolean)
class TermCaption(Base):
__tablename__ = 'term_caption'
id = Column(Integer, primary_key=True)
term_id = Column(Integer, ForeignKey("terms.id"), nullable="False")
caption_id = Column(Integer, ForeignKey("captions.id"), nullable="False")
class Term(Base):
__tablename__ = 'terms'
id = Column(Integer, primary_key=True)
theme = Column(Text)
term = Column(Text)
spellings = Column(Text)
positive = Column(Boolean)
class TermsInVideo(Base):
__tablename__ = 'terms_in_video'
id = Column(Integer, primary_key=True)
video_id = Column(Integer, ForeignKey("videos.id"), nullable="False")
minute = Column(Integer)
terms = Column(Text)