You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
from flask import Flask, jsonify, send_from_directory
|
|
|
|
app = Flask(__name__, static_folder="public", static_url_path="")
|
|
|
|
# 根路径返回 index.html
|
|
@app.route("/")
|
|
def serve_index():
|
|
return send_from_directory(app.static_folder, "index.html")
|
|
|
|
# API 子路径,提供《哪吒2》的宣传数据
|
|
@app.route("/api/nezha2")
|
|
def api_nezha2():
|
|
nezha2_data = {
|
|
"message": "《哪吒2》宣传信息",
|
|
"data": {
|
|
"title": "《哪吒2》",
|
|
"description": "《哪吒2》是继《哪吒之魔童降世》后的续作,讲述了哪吒的全新冒险故事。",
|
|
"trailer_url": "https://www.bilibili.com/video/BV11McieTEN5/",
|
|
"cast": [
|
|
{"name": "哪吒", "role": "主角", "description": "勇敢无畏的少年英雄"},
|
|
{"name": "敖丙", "role": "配角", "description": "哪吒的挚友与对手"},
|
|
{"name": "太乙真人", "role": "配角", "description": "哪吒的师父,搞笑又神秘"}
|
|
],
|
|
"release_date": "2025年12月25日",
|
|
"rating": "PG-13"
|
|
}
|
|
}
|
|
return jsonify(nezha2_data)
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True,host="0.0.0.0" ,port=80)
|