More logging
This commit is contained in:
parent
246de3e29d
commit
e2d6cabed5
3
app.py
3
app.py
@ -283,11 +283,14 @@ def proxy(video_id):
|
|||||||
logger.info(f"Received request for video ID: {video_id}")
|
logger.info(f"Received request for video ID: {video_id}")
|
||||||
|
|
||||||
if cache:
|
if cache:
|
||||||
|
logging.info(f"Checking cache for video ID: {video_id}")
|
||||||
cached_html = cache.get(video_id)
|
cached_html = cache.get(video_id)
|
||||||
if cached_html is not None:
|
if cached_html is not None:
|
||||||
logger.info(f"Using cached response for video ID: {video_id}")
|
logger.info(f"Using cached response for video ID: {video_id}")
|
||||||
return Response(cached_html, mimetype="text/html") # type: ignore
|
return Response(cached_html, mimetype="text/html") # type: ignore
|
||||||
|
|
||||||
|
logging.info(f"Cache miss for video ID: {video_id} - fetching")
|
||||||
|
|
||||||
# Not in cache or cache expired; fetch from nicovideo.jp
|
# Not in cache or cache expired; fetch from nicovideo.jp
|
||||||
real_url = f"https://www.nicovideo.jp/watch/{video_id}"
|
real_url = f"https://www.nicovideo.jp/watch/{video_id}"
|
||||||
params, soup = get_data(video_id, real_url)
|
params, soup = get_data(video_id, real_url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user