Skip to content

Commit 44ac1b9

Browse files
committed
Video Shorts API and webhook
1 parent e2abf22 commit 44ac1b9

File tree

28 files changed

+2726
-3
lines changed

28 files changed

+2726
-3
lines changed

conftest.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,82 @@ def mock_apsisix_auth(mocker):
3939
mock_login = mocker.patch("main.middleware.apisix_user.login")
4040
mock_logout = mocker.patch("main.middleware.apisix_user.logout")
4141
return SimpleNamespace(login=mock_login, logout=mock_logout)
42+
43+
44+
@pytest.fixture
45+
def sample_youtube_metadata():
46+
"""Sample YouTube API v3 metadata for testing video shorts webhook"""
47+
return {
48+
"contentDetails": {
49+
"caption": "false",
50+
"contentRating": {},
51+
"definition": "hd",
52+
"dimension": "2d",
53+
"duration": "PT59S",
54+
"licensedContent": False,
55+
"projection": "rectangular",
56+
},
57+
"etag": "woYA2syI9y2lnDCE2QN4GAi7Rzs",
58+
"id": "k_AA4_fQIHc",
59+
"kind": "youtube#video",
60+
"snippet": {
61+
"categoryId": "27",
62+
"channelId": "UCN0QBfKk0ZSytyX_16M11fA",
63+
"channelTitle": "MIT Open Learning",
64+
"defaultAudioLanguage": "en",
65+
"defaultLanguage": "en",
66+
"description": (
67+
"The Kármán line is 100 kilometers above Earth's surface. "
68+
"For context, that distance is shorter than a trip between "
69+
"Boston and New York City or London and Paris.\n\n"
70+
"Keep learning about spaceflight with MIT Prof. Jeff Hoffman "
71+
"on MIT Learn: https://learn.mit.edu/search?resource=2766"
72+
),
73+
"liveBroadcastContent": "none",
74+
"localized": {
75+
"description": (
76+
"The Kármán line is 100 kilometers above Earth's surface. "
77+
"For context, that distance is shorter than a trip between "
78+
"Boston and New York City or London and Paris.\n\n"
79+
"Keep learning about spaceflight with MIT Prof. Jeff Hoffman "
80+
"on MIT Learn: https://learn.mit.edu/search?resource=2766"
81+
),
82+
"title": "How far away is space?",
83+
},
84+
"publishedAt": "2025-09-24T15:33:27Z",
85+
"thumbnails": {
86+
"default": {
87+
"height": 90,
88+
"url": "https://i.ytimg.com/vi/k_AA4_fQIHc/default.jpg",
89+
"width": 120,
90+
},
91+
"high": {
92+
"height": 360,
93+
"url": "https://i.ytimg.com/vi/k_AA4_fQIHc/hqdefault.jpg",
94+
"width": 480,
95+
},
96+
"maxres": {
97+
"height": 720,
98+
"url": "https://i.ytimg.com/vi/k_AA4_fQIHc/maxresdefault.jpg",
99+
"width": 1280,
100+
},
101+
"medium": {
102+
"height": 180,
103+
"url": "https://i.ytimg.com/vi/k_AA4_fQIHc/mqdefault.jpg",
104+
"width": 320,
105+
},
106+
"standard": {
107+
"height": 480,
108+
"url": "https://i.ytimg.com/vi/k_AA4_fQIHc/sddefault.jpg",
109+
"width": 640,
110+
},
111+
},
112+
"title": "How far away is space?",
113+
},
114+
"statistics": {
115+
"commentCount": "1",
116+
"favoriteCount": "0",
117+
"likeCount": "103",
118+
"viewCount": "3413",
119+
},
120+
}

0 commit comments

Comments
 (0)