feat: 오늘 화면 히어로 아래 날씨각 유튜브 쇼츠 줄 — 첫 카드 소리 없이 자동재생, 누르면 전체 화면에서 위아래로 넘겨 보기. 목록은 /v1/shorts(API 키 있으면 채널 쇼츠, 없으면 설정한 영상 ID), 1시간 캐시
This commit is contained in:
1 parent
f9988855d3
commit
b718955927
15 files changed
+875
-6
No files matched your search
@@ -18,6 +18,7 @@ from router.v1.reaction.reaction import router as reaction_router
|
||||
from router.v1.region.region import router as region_router
|
||||
from router.v1.season.season import router as season_router
|
||||
from router.v1.seo.seo import router as seo_router
|
||||
from router.v1.shorts.shorts import router as shorts_router
|
||||
from router.v1.sky.sky import router as sky_router
|
||||
from router.v1.talk.talk import router as talk_router
|
||||
from router.v1.watch.watch import router as watch_router
|
||||
@@ -53,6 +54,7 @@ app.include_router(image_router)
|
||||
app.include_router(seo_router)
|
||||
app.include_router(card_router)
|
||||
app.include_router(reel_router)
|
||||
app.include_router(shorts_router)
|
||||
|
||||
|
||||
class Res_Health(Res_WebPacketProtocol):
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
|
||||
class ShortItem(WebPacketProtocol):
|
||||
id: str # 유튜브 영상 ID
|
||||
title: str
|
||||
|
||||
|
||||
class Res_ShortList(Res_WebPacketProtocol):
|
||||
items: list[ShortItem] = []
|
||||
@@ -0,0 +1,16 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from common.enums import ErrorType
|
||||
from common.models.errors import error_info
|
||||
from router.v1.shorts.protocol import Res_ShortList, ShortItem
|
||||
from services.shorts_service import ShortsService
|
||||
|
||||
router = APIRouter(prefix="/v1/shorts", tags=["shorts"])
|
||||
|
||||
|
||||
@router.get("", response_model=Res_ShortList, response_model_exclude_none=True, summary="오늘 화면 쇼츠 줄: 날씨각 유튜브 채널의 쇼츠, 최신순")
|
||||
async def list_shorts(service: ShortsService = Depends()) -> Res_ShortList:
|
||||
err, items = await service.items()
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_ShortList(result=error_info(err))
|
||||
return Res_ShortList(items=[ShortItem(**i) for i in items])
|
||||
Reference in new issue
Block a user