Skip to content

Commit de96f39

Browse files
authored
Update constants.py
1 parent a61714f commit de96f39

1 file changed

Lines changed: 52 additions & 123 deletions

File tree

Lines changed: 52 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,77 @@
1-
from enum import Enum
2-
3-
4-
requestPayload = {
1+
RequestPayload = {
52
"context": {
63
"client": {
74
"clientName": "WEB",
85
"clientVersion": "2.20241210.01.00",
96
"newVisitorCookie": True,
7+
"utcOffsetMinutes": 0,
108
},
119
"user": {
1210
"lockedSafetyMode": False,
13-
},
11+
}
1412
}
1513
}
1614

17-
userAgent = (
18-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
19-
"AppleWebKit/537.36 (KHTML, like Gecko) "
20-
"Chrome/122.0.0.0 Safari/537.36"
21-
)
22-
23-
videoElementKey = "videoRenderer"
24-
channelElementKey = "channelRenderer"
25-
playlistElementKey = "playlistRenderer"
26-
shelfElementKey = "shelfRenderer"
27-
itemSectionKey = "itemSectionRenderer"
28-
continuationItemKey = "continuationItemRenderer"
29-
playerResponseKey = "playerResponse"
30-
richItemKey = "richItemRenderer"
31-
hashtagElementKey = "hashtagTileRenderer"
32-
hashtagBrowseKey = "FEhashtag"
33-
34-
hashtagVideosPath = [
35-
"contents",
36-
"twoColumnBrowseResultsRenderer",
37-
"tabs",
38-
0,
39-
"tabRenderer",
40-
"content",
41-
"richGridRenderer",
42-
"contents",
43-
]
44-
45-
hashtagContinuationVideosPath = [
46-
"onResponseReceivedActions",
47-
0,
48-
"appendContinuationItemsAction",
49-
"continuationItems",
50-
]
51-
52-
searchKey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
53-
54-
contentPath = [
55-
"contents",
56-
"twoColumnSearchResultsRenderer",
57-
"primaryContents",
58-
"sectionListRenderer",
59-
"contents",
60-
]
61-
62-
fallbackContentPath = [
63-
"contents",
64-
"twoColumnSearchResultsRenderer",
65-
"primaryContents",
66-
"richGridRenderer",
67-
"contents",
68-
]
69-
70-
continuationContentPath = [
71-
"onResponseReceivedCommands",
72-
0,
73-
"appendContinuationItemsAction",
74-
"continuationItems",
75-
]
76-
77-
continuationKeyPath = [
78-
"continuationItemRenderer",
79-
"continuationEndpoint",
80-
"continuationCommand",
81-
"token",
82-
]
83-
84-
playlistInfoPath = [
85-
"response",
86-
"sidebar",
87-
"playlistSidebarRenderer",
88-
"items",
89-
]
90-
91-
playlistVideosPath = [
92-
"response",
93-
"contents",
94-
"twoColumnBrowseResultsRenderer",
95-
"tabs",
96-
0,
97-
"tabRenderer",
98-
"content",
99-
"sectionListRenderer",
100-
"contents",
101-
0,
102-
"itemSectionRenderer",
103-
"contents",
104-
0,
105-
"playlistVideoListRenderer",
106-
"contents",
107-
]
108-
109-
playlistPrimaryInfoKey = "playlistSidebarPrimaryInfoRenderer"
110-
playlistSecondaryInfoKey = "playlistSidebarSecondaryInfoRenderer"
111-
playlistVideoKey = "playlistVideoRenderer"
112-
113-
114-
class ResultMode(int, Enum):
15+
userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
16+
17+
videoElementKey = 'videoRenderer'
18+
channelElementKey = 'channelRenderer'
19+
playlistElementKey = 'playlistRenderer'
20+
shelfElementKey = 'shelfRenderer'
21+
itemSectionKey = 'itemSectionRenderer'
22+
continuationItemKey = 'continuationItemRenderer'
23+
playerResponseKey = 'playerResponse'
24+
richItemKey = 'richItemRenderer'
25+
hashtagElementKey = 'hashtagTileRenderer'
26+
hashtagBrowseKey = 'FEhashtag'
27+
28+
hashtagVideosPath = ['contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'richGridRenderer', 'contents']
29+
hashtagContinuationVideosPath = ['onResponseReceivedActions', 0, 'appendContinuationItemsAction', 'continuationItems']
30+
searchKey = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8'
31+
contentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'sectionListRenderer', 'contents']
32+
fallbackContentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'richGridRenderer', 'contents']
33+
continuationContentPath = ['onResponseReceivedCommands', 0, 'appendContinuationItemsAction', 'continuationItems']
34+
continuationKeyPath = ['continuationItemRenderer', 'continuationEndpoint', 'continuationCommand', 'token']
35+
playlistInfoPath = ['response', 'sidebar', 'playlistSidebarRenderer', 'items']
36+
playlistVideosPath = ['response', 'contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'sectionListRenderer', 'contents', 0, 'itemSectionRenderer', 'contents', 0, 'playlistVideoListRenderer', 'contents']
37+
38+
playlistPrimaryInfoKey = 'playlistSidebarPrimaryInfoRenderer'
39+
playlistSecondaryInfoKey = 'playlistSidebarSecondaryInfoRenderer'
40+
playlistVideoKey = 'playlistVideoRenderer'
41+
42+
43+
class ResultMode:
11544
json = 0
11645
dict = 1
11746

11847

119-
class SearchMode(str, Enum):
120-
videos = "EgIQAQ%3D%3D"
121-
channels = "EgIQAg%3D%3D"
122-
playlists = "EgIQAw%3D%3D"
123-
livestreams = "EgJAAQ%3D%3D"
48+
class SearchMode:
49+
videos = 'EgIQAQ%3D%3D'
50+
channels = 'EgIQAg%3D%3D'
51+
playlists = 'EgIQAw%3D%3D'
52+
livestreams = 'EgJAAQ%3D%3D'
12453

12554

126-
class VideoUploadDateFilter(str, Enum):
127-
lastHour = "EgQIARAB"
128-
today = "EgQIAhAB"
129-
thisWeek = "EgQIAxAB"
130-
thisMonth = "EgQIBBAB"
131-
thisYear = "EgQIBRAB"
55+
class VideoUploadDateFilter:
56+
lastHour = 'EgQIARAB'
57+
today = 'EgQIAhAB'
58+
thisWeek = 'EgQIAxAB'
59+
thisMonth = 'EgQIBBAB'
60+
thisYear = 'EgQIBRAB'
13261

13362

134-
class VideoDurationFilter(str, Enum):
135-
short = "EgQQARgB"
136-
long = "EgQQARgC"
63+
class VideoDurationFilter:
64+
short = 'EgQQARgB'
65+
long = 'EgQQARgC'
13766

13867

139-
class VideoSortOrder(str, Enum):
140-
relevance = "CAASAhAB"
141-
uploadDate = "CAISAhAB"
142-
viewCount = "CAMSAhAB"
143-
rating = "CAESAhAB"
68+
class VideoSortOrder:
69+
relevance = 'CAASAhAB'
70+
uploadDate = 'CAISAhAB'
71+
viewCount = 'CAMSAhAB'
72+
rating = 'CAESAhAB'
14473

14574

146-
class ChannelRequestType(str, Enum):
75+
class ChannelRequestType:
14776
info = "EgVhYm91dA%3D%3D"
14877
playlists = "EglwbGF5bGlzdHMYAyABcAA%3D"

0 commit comments

Comments
 (0)