|
| 1 | +from enum import Enum |
| 2 | + |
| 3 | + |
1 | 4 | requestPayload = { |
2 | 5 | "context": { |
3 | 6 | "client": { |
|
7 | 10 | }, |
8 | 11 | "user": { |
9 | 12 | "lockedSafetyMode": False, |
10 | | - } |
| 13 | + }, |
11 | 14 | } |
12 | 15 | } |
13 | | -userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' |
14 | | - |
15 | | - |
16 | | -videoElementKey = 'videoRenderer' |
17 | | -channelElementKey = 'channelRenderer' |
18 | | -playlistElementKey = 'playlistRenderer' |
19 | | -shelfElementKey = 'shelfRenderer' |
20 | | -itemSectionKey = 'itemSectionRenderer' |
21 | | -continuationItemKey = 'continuationItemRenderer' |
22 | | -playerResponseKey = 'playerResponse' |
23 | | -richItemKey = 'richItemRenderer' |
24 | | -hashtagElementKey = 'hashtagTileRenderer' |
25 | | -hashtagBrowseKey = 'FEhashtag' |
26 | | -hashtagVideosPath = ['contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'richGridRenderer', 'contents'] |
27 | | -hashtagContinuationVideosPath = ['onResponseReceivedActions', 0, 'appendContinuationItemsAction', 'continuationItems'] |
28 | | -searchKey = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' |
29 | | -contentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'sectionListRenderer', 'contents'] |
30 | | -fallbackContentPath = ['contents', 'twoColumnSearchResultsRenderer', 'primaryContents', 'richGridRenderer', 'contents'] |
31 | | -continuationContentPath = ['onResponseReceivedCommands', 0, 'appendContinuationItemsAction', 'continuationItems'] |
32 | | -continuationKeyPath = ['continuationItemRenderer', 'continuationEndpoint', 'continuationCommand', 'token'] |
33 | | -playlistInfoPath = ['response', 'sidebar', 'playlistSidebarRenderer', 'items'] |
34 | | -playlistVideosPath = ['response', 'contents', 'twoColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content', 'sectionListRenderer', 'contents', 0, 'itemSectionRenderer', 'contents', 0, 'playlistVideoListRenderer', 'contents'] |
35 | | -playlistPrimaryInfoKey = 'playlistSidebarPrimaryInfoRenderer' |
36 | | -playlistSecondaryInfoKey = 'playlistSidebarSecondaryInfoRenderer' |
37 | | -playlistVideoKey = 'playlistVideoRenderer' |
38 | | - |
39 | | - |
40 | | -class ResultMode: |
| 16 | + |
| 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): |
41 | 115 | json = 0 |
42 | 116 | dict = 1 |
43 | 117 |
|
44 | 118 |
|
45 | | -class SearchMode: |
46 | | - videos = 'EgIQAQ%3D%3D' |
47 | | - channels = 'EgIQAg%3D%3D' |
48 | | - playlists = 'EgIQAw%3D%3D' |
49 | | - livestreams = 'EgJAAQ%3D%3D' |
| 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" |
50 | 124 |
|
51 | 125 |
|
52 | | -class VideoUploadDateFilter: |
53 | | - lastHour = 'EgQIARAB' |
54 | | - today = 'EgQIAhAB' |
55 | | - thisWeek = 'EgQIAxAB' |
56 | | - thisMonth = 'EgQIBBAB' |
57 | | - thisYear = 'EgQIBRAB' |
| 126 | +class VideoUploadDateFilter(str, Enum): |
| 127 | + lastHour = "EgQIARAB" |
| 128 | + today = "EgQIAhAB" |
| 129 | + thisWeek = "EgQIAxAB" |
| 130 | + thisMonth = "EgQIBBAB" |
| 131 | + thisYear = "EgQIBRAB" |
58 | 132 |
|
59 | 133 |
|
60 | | -class VideoDurationFilter: |
61 | | - short = 'EgQQARgB' |
62 | | - long = 'EgQQARgC' |
| 134 | +class VideoDurationFilter(str, Enum): |
| 135 | + short = "EgQQARgB" |
| 136 | + long = "EgQQARgC" |
63 | 137 |
|
64 | 138 |
|
65 | | -class VideoSortOrder: |
66 | | - relevance = 'CAASAhAB' |
67 | | - uploadDate = 'CAISAhAB' |
68 | | - viewCount = 'CAMSAhAB' |
69 | | - rating = 'CAESAhAB' |
| 139 | +class VideoSortOrder(str, Enum): |
| 140 | + relevance = "CAASAhAB" |
| 141 | + uploadDate = "CAISAhAB" |
| 142 | + viewCount = "CAMSAhAB" |
| 143 | + rating = "CAESAhAB" |
70 | 144 |
|
71 | 145 |
|
72 | | -class ChannelRequestType: |
| 146 | +class ChannelRequestType(str, Enum): |
73 | 147 | info = "EgVhYm91dA%3D%3D" |
74 | 148 | playlists = "EglwbGF5bGlzdHMYAyABcAA%3D" |
0 commit comments