AI 生成: 一个仿 aptv.pro 的视频站点,使用 Python Flask 构建,包含视频列表、分类、搜索和视频播放页面。

This commit is contained in:
eeuse
2026-09-28 22:34:54 +08:00
commit b0ecaa4122
9 changed files with 673 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}APTV - 在线影视{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header class="header">
<div class="container header-inner">
<a href="{{ url_for('index') }}" class="logo">APTV<span>.pro</span></a>
<form class="search-form" action="{{ url_for('index') }}" method="get">
<input type="text" name="q" placeholder="搜索影片..." value="{{ keyword or '' }}">
<button type="submit">搜索</button>
</form>
</div>
</header>
<main class="container">
{% if not_found %}
<div class="empty">
<h2>404 - 页面不存在</h2>
<p><a href="{{ url_for('index') }}">返回首页</a></p>
</div>
{% else %}
{% block content %}{% endblock %}
{% endif %}
</main>
<footer class="footer">
<div class="container">
<p>© 2024 APTV.pro Clone · 仅供学习交流</p>
</div>
</footer>
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
</body>
</html>
+50
View File
@@ -0,0 +1,50 @@
{% extends "base.html" %}
{% block title %}{{ video.title }} - APTV{% endblock %}
{% block content %}
<div class="detail">
<div class="player-wrap">
<video class="player" controls poster="{{ video.cover }}" preload="metadata">
<source src="{{ video.url }}" type="video/mp4">
你的浏览器不支持 HTML5 视频。
</video>
</div>
<div class="detail-info">
<div class="detail-cover">
<img src="{{ video.cover }}" alt="{{ video.title }}">
</div>
<div class="detail-text">
<h1>{{ video.title }}</h1>
<p class="detail-meta">
<span class="tag">{{ video.category }}</span>
<span>{{ video.year }}</span>
<span class="score">评分 {{ video.rating }}</span>
</p>
<p class="detail-desc">{{ video.description }}</p>
<a href="{{ url_for('index') }}" class="back-btn">← 返回首页</a>
</div>
</div>
{% if related %}
<section class="related">
<h2 class="section-title">相关推荐</h2>
<div class="grid">
{% for v in related %}
<a class="card" href="{{ url_for('detail', vid=v.id) }}">
<div class="cover">
<img src="{{ v.cover }}" alt="{{ v.title }}" loading="lazy">
<span class="rating">{{ v.rating }}</span>
</div>
<div class="card-body">
<h3 class="card-title">{{ v.title }}</h3>
<p class="card-meta">{{ v.year }} · {{ v.category }}</p>
</div>
</a>
{% endfor %}
</div>
</section>
{% endif %}
</div>
{% endblock %}
+39
View File
@@ -0,0 +1,39 @@
{% extends "base.html" %}
{% block title %}APTV - 首页{% endblock %}
{% block content %}
<nav class="categories">
<a href="{{ url_for('index', q=keyword) }}" class="cat {% if not current_category %}active{% endif %}">全部</a>
{% for cat in categories %}
<a href="{{ url_for('index', category=cat, q=keyword) }}"
class="cat {% if current_category == cat %}active{% endif %}">{{ cat }}</a>
{% endfor %}
</nav>
{% if keyword %}
<p class="result-tip">搜索 “{{ keyword }}” 共找到 {{ videos|length }} 条结果</p>
{% endif %}
{% if videos %}
<div class="grid">
{% for v in videos %}
<a class="card" href="{{ url_for('detail', vid=v.id) }}">
<div class="cover">
<img src="{{ v.cover }}" alt="{{ v.title }}" loading="lazy">
<span class="rating">{{ v.rating }}</span>
</div>
<div class="card-body">
<h3 class="card-title">{{ v.title }}</h3>
<p class="card-meta">{{ v.year }} · {{ v.category }}</p>
</div>
</a>
{% endfor %}
</div>
{% else %}
<div class="empty">
<h2>没有找到相关影片</h2>
<p>试试其他关键词或分类吧</p>
</div>
{% endif %}
{% endblock %}