commit0530.1

main
longchengyun 6 months ago
parent f95720b9af
commit e7629934f6

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.12 (flaskProject)" /> <option name="sdkName" value="Python 3.12 (xuexi)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (pythonProject)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (xuexi)" project-jdk-type="Python SDK" />
</project> </project>

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/flaskProject.iml" filepath="$PROJECT_DIR$/.idea/flaskProject.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/xuexi.iml" filepath="$PROJECT_DIR$/.idea/xuexi.iml" />
</modules> </modules>
</component> </component>
</project> </project>

Binary file not shown.

@ -4,7 +4,6 @@ import lxml
app = Flask(__name__) app = Flask(__name__)
def getDB(): def getDB():
'''连接数据库''' '''连接数据库'''
db = pymysql.connect(host='localhost',user='root',password='shengji.',database='douban',) db = pymysql.connect(host='localhost',user='root',password='shengji.',database='douban',)
@ -12,12 +11,15 @@ def getDB():
#跳转主页
@app.route('/') @app.route('/')
def home(): # put application's code here def home(): # put application's code here
return render_template('index.html') return render_template('index.html')
@app.route('/index')
def index(): # put application's code here
return render_template('index.html')
@app.route('/movies') @app.route('/movies')
@app.route('/movies/<int:page>') @app.route('/movies/<int:page>')
@ -42,5 +44,56 @@ def movies(page = 1):# put application's code here
@app.route('/tj')
def tj():# put application's code here
db = getDB()
cursor = db.cursor()
#电影评分分布图
rating = [] #评分
num = [] #每个电影评分统计出的电影数量
sql = "select rating_num,count(*) from movies GROUP BY rating_num"
cursor.execute(sql)
data = cursor.fetchall()
for item in data:
rating.append(float(item[0]))
num.append(item[1])
#电影类型分布图
filmtypes_list = [] #类型列表
filmtypes_num = [] #类型数量
sql1 = "select filmtype,count(filmtype) from movietype GROUP BY filmtype"
cursor.execute(sql1)
data1 = cursor.fetchall()
for item1 in data1:
filmtypes_list.append(item1[0])
filmtypes_num.append(item1[1])
#20年内电影上映数量统计图
years = [] #年
years_num = [] #每年的电影数量
sql2 = "select YEAR(STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d')) as years,count(*) from movies WHERE STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d')>DATE_SUB(CURRENT_DATE,INTERVAL 20 YEAR)GROUP BY YEAR(STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d'))ORDER BY YEAR(STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d'))"
cursor.execute(sql2)
data2 = cursor.fetchall()
for item2 in data2:
years.append(item2[0])
years_num.append(item2[1])
#电影数量最多的top10年份
top10 = [] #电影数量最多的top10年份的列表
top10_num = [] #电影数量最多的top10年份的电影数量
sql3 = "select YEAR(STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d')) as years,count(*) from movies GROUP BY YEAR(STR_TO_DATE(initialrReleaseDate,'%Y-%m-%d'))ORDER BY count(*) desc limit 10 "
cursor.execute(sql3)
data3 = cursor.fetchall()
for item3 in data3:
top10.append(item3[0])
top10_num.append(item3[1])
return render_template('tj.html',rating=rating,num=num,filmtypes_list=filmtypes_list,filmtypes_num=filmtypes_num,
years=years,years_num=years_num,top10=top10,top10_num=top10_num)
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()

@ -62,6 +62,22 @@ def get_url_info(film_url,film_name_en,id):
actor = soup.find(attrs={'id':"info"}).text.split('\n')[3].split(':')[1].strip() actor = soup.find(attrs={'id':"info"}).text.split('\n')[3].split(':')[1].strip()
# 类型 # 类型
filmtype = soup.find(attrs={'id': "info"}).text.split('\n')[4].split(':')[1].strip() filmtype = soup.find(attrs={'id': "info"}).text.split('\n')[4].split(':')[1].strip()
types = filmtype.split("/")
if soup.find(attrs={'id': "info"}).text.split('\n')[5].split(':')[0] =='官方网站':
# 制片国家/地区
area = soup.find(attrs={'id': "info"}).text.split('\n')[6].split(':')[1].strip()
# 语言
language = soup.find(attrs={'id': "info"}).text.split('\n')[7].split(':')[1].strip()
# 上映日期
initialrReleaseDate = soup.find(attrs={'id': "info"}).text.split('\n')[8].split(':')[1].split('(')[0].strip()
else:
# 制片国家/地区
area = soup.find(attrs={'id': "info"}).text.split('\n')[5].split(':')[1].strip()
# 语言
language = soup.find(attrs={'id': "info"}).text.split('\n')[6].split(':')[1].strip()
# 上映日期
initialrReleaseDate = soup.find(attrs={'id': "info"}).text.split('\n')[7].split(':')[1].split('(')[0].strip()
# 片长 # 片长
runtime = soup.find(attrs={'property': "v:runtime"}).text runtime = soup.find(attrs={'property': "v:runtime"}).text
# 评分(平均分) # 评分(平均分)
@ -70,19 +86,19 @@ def get_url_info(film_url,film_name_en,id):
stars5_rating_per = soup.find(attrs={'class': "rating_per"}).text stars5_rating_per = soup.find(attrs={'class': "rating_per"}).text
# 评价人数 # 评价人数
rating_people = soup.find(attrs={'property': "v:votes"}).text rating_people = soup.find(attrs={'property': "v:votes"}).text
# 剧情简介 #剧情简介
summary = soup.find(attrs={'property': "v:summary"}).text summary = soup.find(attrs={'property': "v:summary"}).text
summary = pymysql.converters.escape_string(summary) summary = pymysql.converters.escape_string(summary)
#存到数据库
sql = 'insert into movies(film_name,director,scriptwriter,actor,filmtype,area,language,initialrReleaseDate,ranks,runtime,rating_num,stars5_rating_per,rating_people,summary,film_name_en,links) values("{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}");'.format(film_name,director,scriptwriter,actor,filmtype,area,language,initialrReleaseDate,ranks,runtime,rating_num,stars5_rating_per,rating_people,summary,film_name_en,film_url)
sql = 'insert into movies(film_name,director,scriptwriter,actor,filmtype,area,language,initialrReleaseDate,ranks,runtime,rating_num,stars5_rating_per,rating_people,summary,film_name_en,links) values("{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}","{}");'.format(film_name,director,scriptwriter,actor,filmtype,area,language,initialrReleaseDate,ranks,runtime,rating_num,stars5_rating_per,rating_people,summary,film_name_en,film_url)
db = getDB() db = getDB()
try: try:
cursor = db.cursor() cursor = db.cursor()
cursor.execute(sql) cursor.execute(sql)
cursor.execute('insert into moviehash(movieid) values("{}")'.format(id)) cursor.execute('insert into moviehash(movieid) values("{}")'.format(id))
for j in range(len(types)):
cursor.execute('insert into movietype(movieid,filmtype) values("{}","{}")'.format(id,types[j].strip()))
db.commit() db.commit()
except Exception as e: except Exception as e:
print(e) print(e)
@ -91,13 +107,11 @@ sql = 'insert into movies(film_name,director,scriptwriter,actor,filmtype,area,la
db.close() db.close()
if __name__ == '__main__': if __name__ == '__main__':
print('开始抓取') print('开始抓取')
db = getDB() db = getDB()
cursor = db.cursor() cursor = db.cursor()
for i in range(0,50,25): for i in range(0,250,25):
film_urls, movie_list = get_url("https://movie.douban.com/top250?start="+str(i)+"&filter=") film_urls, movie_list = get_url("https://movie.douban.com/top250?start="+str(i)+"&filter=")
for film_url in range(len(film_urls)): for film_url in range(len(film_urls)):
id = re.search('\d\d+',film_urls[film_url]).group() id = re.search('\d\d+',film_urls[film_url]).group()
@ -106,3 +120,4 @@ if __name__ == '__main__':
data = cursor.fetchall() data = cursor.fetchall()
if not data: if not data:
get_url_info(film_urls[film_url],movie_list[film_url],id) get_url_info(film_urls[film_url],movie_list[film_url],id)
# get_url_info("https://movie.douban.com/subject/1291561/","111","1291561")

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>首页</title>
<link rel="stylesheet" href="static/assets/css/fontawesome.min.css">
<link rel="stylesheet" href="static/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="static/assets/css/template-style.css">
<link href="static/assets/img/favicon.png" rel="icon">
<link href="static/assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<link href="static/assets/vendor/icofont/icofont.min.css" rel="stylesheet">
<link href="static/assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="static/assets/vendor/animate.css/animate.min.css" rel="stylesheet">
<link href="static/assets/vendor/venobox/venobox.css" rel="stylesheet">
<link href="static/assets/vendor/aos/aos.css" rel="stylesheet">
<link href="static/assets/css/style.css" rel="stylesheet">
<style>
.container ul li{
color: #ffffff;
}
.container ul li p {
color: #9eccf4;
font-size: 17px;
margin-top: auto;
}
.container ul li .question {
font-size: 19px;
color: #ffffff;
}
</style>
</head>
<body id="reportsPage">
<div class="" id="home">
{# --------------------导航栏---------------------#}
<nav class="navbar navbar-expand-xl">
<div class="container h-100">
<a class="navbar-brand" href="#">
<h1 class="tm-site-title mb-0">❥(^_-)电影数据分析 (-_^)❥</h1>
</a>
<button class="navbar-toggler ml-auto mr-0" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars tm-nav-icon"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto h-100">
<li class="nav-item">
<a class="nav-link " href="index">
<i class="fa fa-tags" aria-hidden="true"></i>
首页
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="movies">
<i class="fa fa-film" aria-hidden="true"></i>
排行榜
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="tj">
<i class="fa fa-film" aria-hidden="true"></i>
统计
</a>
</li>
</ul>
</div>
</div>
</nav>
{# --------------------容器1--------------------#}
<div class="container">
<div class="row">
<div class="col">
<h3 class="section-title">关于我们</h3>
</div>
</div>
{# -----------------容器2-------------#}
<section class="counts section-bg">
<div class="container">
<ul>
<li>
<p class="question ">这是一个什么样的系统?</p>
<p>&emsp;&emsp;该系统致力于让用户简单明了地查看到电影top250排行榜及其详细信息同时
用户可以通过统计图的呈现了解到历年电影走势、电影类型分布等相关信息,方便用户根据其信息选择电影。</p>
</li><br><hr />
<li>
<p class="question ">为什么要对数据进行分析统计?</p>
<p>&emsp;&emsp;在当今社会,生活节奏越来越快,人们也越来越注重精神享受,而电影已经成为人们日常生活中不可或缺的
娱乐方式。一部好的电影,除了给人们带来放松和娱乐以外,还可以引发人们的思考和文化的传播。<br>&emsp;&emsp;
从微观上来说,如何在有限的时间内找到感兴趣的、高质量的电影就显得很有必要了。对于观看者而言,观影前的影片选择
尤为重要,每个人都有自己的喜好,有的人偏爱喜剧片,有的人偏爱恐怖片,也有的人喜欢爱情片,针对不同观影者的喜好,
将电影类型进行分类,使用户可以通过可视化数据更好的了解电影的类型;针对喜欢看热门电影的用户,可以通过获取的热门
电影排行,有选择的进行观看;针对注重评分的用户来说,可以从他人的评分和影评中了解到这部电影是否值得去看。对于
从事影视行业的人员而言,对电影的类型和数量进行分析,能在归纳数据的基础上了解其分布;分析历年的影片走势,通过
可视化分析得出的统计图预计未来的发展方向;还可通过相关技术提取影评关键词,更好的了解用户的喜好和需求,制作出
令观众满意的作品。<br>&emsp;&emsp;从宏观上来说,中国电影行业的产业链的经营还不够专业化,现在一些圈外的资
本为了利益,在缺乏专业性的情况下,也开始随大众投入电影行业,在这样的背景下,进行相关数据的分析有利于提高电影
行业的专业性和科学性,提高影片的质量。虽然在庞大的网络体系下,每一条数据看似杂乱无章,但是在进行技术分析后,
都会绘成一张张清晰的偏好图谱,从而制片方可以更好的利用反馈制定精准的宣发策略。</p>
</li><br><hr />
<li>
<p class="question ">如何使用该系统?</p>
<p>1.你可以通过点击菜单”排行榜“查看top250榜单<br>
2.你可以点击具体的电影名称进入页面查看该电影的详细介绍;<br>
3.你可以通过点击菜单“统计”查看:根据电影评分、电影类型、上映年份等形成的统计图;<br>
</p>
</li><br><hr />
<li>
<p class="question ">温馨提示:</p>
<p>1.数据分析并不能保证电影的艺术价值和质量;<br>
2.即使是真实的数据也会影响分析的有效性;<br>
3.该系统研究的数据有限,不一定能满足所有用户的需求;<br>
4.该系统研究的数据以及分析结果仅供参考。</p>
</li><br><hr />
</ul>
</div>
</section>
</div>
{#----------页脚----------#}
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-6 footer-links">
<h4>快速了解我们</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">关于我们</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">服务</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="index">首页</a></li>
</ul>
</div>
<div class="col-lg-3 col-md-6 footer-links">
<h4>服务</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影top250</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影评分</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影短评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影热评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影统计图</a></li>
</ul>
</div>
<div class="col-lg-4 col-md-6 footer-newsletter">
<h4>关注我们</h4>
<p>输入你的邮箱,带你了解更多电影信息</p>
<form action="" method="post">
<input type="email" name="email"><input type="submit" value="订阅">
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div class="copyright">Copyright &copy;2022 xxx</div>
<div class="credits"></div>
</div>
</footer><!-- End Footer -->
</div>
<script src="static/assets/js/jquery-3.3.1.min.js"></script>
<script src="static/assets/js/moment.min.js"></script>
<script src="static/assets/js/Chart.min.js"></script>
<script src="static/assets/js/bootstrap.min.js"></script>
<script src="static/assets/js/tooplate-scripts.js"></script>
</body>
</html>

@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>电影top250</title>
<link rel="stylesheet" href="{{ url_for("static", filename="assets/css/bootstrap.min.css") }}">
<link rel="stylesheet" href="{{ url_for("static", filename="assets/css/bootstrap.min.css") }}">
<link rel="stylesheet" href="{{ url_for("static", filename="assets/css/template-style.css") }}">
<link href="{{ url_for("static",filename="static/assets/img/favicon.png") }}" rel="icon">
<link href="{{ url_for("static",filename="assets/img/apple-touch-icon.png") }}" rel="apple-touch-icon">
<link href="{{ url_for("static",filename="assets/vendor/icofont/icofont.min.css") }}" rel="stylesheet">
<link href="{{ url_for("static",filename="assets/vendor/boxicons/css/boxicons.min.css") }}" rel="stylesheet">
<link href="{{ url_for("static",filename="assets/vendor/animate.css/animate.min.css") }}" rel="stylesheet">
<link href="{{ url_for("static",filename="assets/vendor/venobox/venobox.css") }}" rel="stylesheet">
<link href="{{ url_for("static",filename="assets/vendor/aos/aos.css") }}" rel="stylesheet">
<link href="{{ url_for("static",filename="assets/css/style.css") }}" rel="stylesheet">
</head>
<style>
.wl-Page{
width: 100%;
}
.wl-pagination{
display: inline-block;
margin: 0 -15px;
}
.wl-pagination>li>a{
display: inline-block;
padding: 15px;
border:1px solid #ccc;
text-decoration: none;
color: rgb(63, 57, 57);
}
.wl-pagination>li{
display: inline-block;
/* float: left; */
list-style: none;
}
.wl-pagination-bgc>li>a{
background-color: #f4f4f5;
color: #303133;
font-size: 12px;
padding: 8px;
border: 1px solid #f4f4f5;
font-weight: 900;
}
.wl-pagination-bgc .active>a{
background-color: rgb(0, 153, 255);
color: #fff;
}
.wl-pagination-bgc>li>a:hover{
background-color: rgb(0, 153, 255);
color: #fff;
}
</style>
<body id="reportsPage">
<div class="" id="home">
{# --------------------导航栏---------------------#}
<nav class="navbar navbar-expand-xl">
<div class="container h-100">
<a class="navbar-brand" href="#">
<h1 class="tm-site-title mb-0">❥(^_-)电影数据分析 (-_^)❥</h1>
</a>
<button class="navbar-toggler ml-auto mr-0" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars tm-nav-icon"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto h-100">
<li class="nav-item">
<a class="nav-link " href="{{url_for("index")}}">
<i class="fa fa-tags" aria-hidden="true"></i>
首页
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="{{url_for("movies")}}">
<i class="fa fa-film" aria-hidden="true"></i>
排行榜
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="{{url_for("tj")}}">
<i class="fa fa-film" aria-hidden="true"></i>
统计
</a>
</li>
</ul>
</div>
</div>
</nav>
{# --------------------容器1--------------------#}
<div class="container">
{# -------------左上角标语-----------#}
<div class="row">
<div class="col">
<h3 class="section-title">豆瓣电影top250排行榜</h3>
</div>
</div>
{# -----------------容器2-------------#}
<section class="counts section-bg">
<div class="container">
<table class="table table-striped">
<tr>
<td style="width: 10%;">电影排名</td>
<td style="width: 10%;">电影中文名称</td>
<td style="width: 10%;">电影外国名称</td>
<td style="width: 10%;">电影评分</td>
<td style="width: 10%;">评分人数</td>
<td>电影简介</td>
<td style="width: 10%;">其他信息</td>
</tr>
{% for movie in movies %}
<tr>
<td>{{ movie[0] }}</td>
<td><a href="{{ movie[1] }}" target="_blank">{{ movie[2] }}</a></td>
<td>{{ movie[3] }}</td>
<td>{{ movie[4] }}</td>
<td>{{ movie[5] }}</td>
<td>{{ movie[6] }}</td>
<td>{{ movie[7] }}</td>
</tr>
{% endfor %}
</table>
{##}
<br>
<nav class="wl-Page">
<ul class="wl-pagination wl-pagination-bgc">
<li class="pre">
{% if page - 1 <= 0 %}
<a href="#">上一页</a>
{% else %}
<a href="{{ url_for('movies', page=(page-1)) }}">上一页</a>
{% endif %}
</li>
<li class="next">
{% if page > countnum %}
<a href="#">下一页</a>
{% else %}
<a href="{{ url_for('movies', page=(page + 1)) }}">下一页</a>
{% endif %}
</li>
<li> <p>总共{{ countnum }}页</p></li>
</ul>
</nav>
</div>
</section>
</div>
{#----------页脚----------#}
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-6 footer-links">
<h4>快速了解我们</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">关于我们</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">服务</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="index">首页</a></li>
</ul>
</div>
<div class="col-lg-3 col-md-6 footer-links">
<h4>服务</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影top250</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影评分</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影短评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影热评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影统计图</a></li>
</ul>
</div>
<div class="col-lg-4 col-md-6 footer-newsletter">
<h4>关注我们</h4>
<p>输入你的邮箱,带你了解更多电影信息</p>
<form action="" method="post">
<input type="email" name="email"><input type="submit" value="订阅">
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div class="copyright">Copyright &copy;2022 xxx</div>
<div class="credits"></div>
</div>
</footer><!-- End Footer -->
</div>
<script src="{{ url_for("static", filename="assets/js/jquery-3.3.1.min.js") }}"></script>
<script src="{{ url_for("static", filename="assets/js/moment.min.js") }}"></script>
<script src="{{ url_for("static", filename="assets/js/Chart.min.js") }}"></script>
<script src="{{ url_for("static", filename="assets/js/bootstrap.min.js") }}"></script>
<script src="{{ url_for("static", filename="assets/js/tooplate-scripts.js") }}"></script>
{# <script src="static/assets/js/jquery-3.3.1.min.js"></script>#}
{# <script src="static/assets/js/moment.min.js"></script>#}
{# <script src="static/assets/js/Chart.min.js"></script>#}
{# <script src="static/assets/js/bootstrap.min.js"></script>#}
{# <script src="static/assets/js/tooplate-scripts.js"></script>#}
</body>
</html>

@ -0,0 +1,367 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>统计</title>
<link rel="stylesheet" href="static/assets/css/fontawesome.min.css">
<link rel="stylesheet" href="static/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="static/assets/css/template-style.css">
<link href="static/assets/img/favicon.png" rel="icon">
<link href="static/assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<link href="static/assets/vendor/icofont/icofont.min.css" rel="stylesheet">
<link href="static/assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="static/assets/vendor/animate.css/animate.min.css" rel="stylesheet">
<link href="static/assets/vendor/venobox/venobox.css" rel="stylesheet">
<link href="static/assets/vendor/aos/aos.css" rel="stylesheet">
<link href="static/assets/css/style.css" rel="stylesheet">
</head>
<body id="reportsPage">
<div class="" id="home">
{# --------------------导航栏---------------------#}
<nav class="navbar navbar-expand-xl">
<div class="container h-100">
<a class="navbar-brand" href="#">
<h1 class="tm-site-title mb-0">❥(^_-)电影数据分析 (-_^)❥</h1>
</a>
<button class="navbar-toggler ml-auto mr-0" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars tm-nav-icon"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto h-100">
<li class="nav-item">
<a class="nav-link " href="index">
<i class="fa fa-tags" aria-hidden="true"></i>
首页
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="movies">
<i class="fa fa-film" aria-hidden="true"></i>
排行榜
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="tj">
<i class="fa fa-film" aria-hidden="true"></i>
统计
</a>
</li>
</ul>
</div>
</nav>
{# --------------------容器1--------------------#}
<div class="container">
{# -------------左上角标语-----------#}
<div class="row">
<div class="col">
<h4 class="text-white mt-5 mb-5">电影评分分布图</h4>
{# <img src="static/assets/img/评分分布.png">#}
</div>
</div>
{# -----------------容器2-------------#}
<section class="counts section-bg">
<div class="container">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
</section>
<br>
<div class="row">
<div class="col">
<h4 class="text-white mt-5 mb-5">电影类型分布图</h4>
</div>
</div>
<section class="counts section-bg">
<div class="container">
<div id="main1" style="width: 100%;height:400px;"></div>
</div>
</section>
<div class="row">
<div class="col">
<h4 class="text-white mt-5 mb-5">20年内电影上映数量统计图</h4>
</div>
</div>
<section class="counts section-bg">
<div class="container">
<div id="main2" style="width: 100%;height:400px;"></div>
</div>
</section>
<div class="row">
<div class="col">
<h4 class="text-white mt-5 mb-5">电影数量最多的top10年份</h4>
</div>
</div>
<section class="counts section-bg">
<div class="container">
<div id="main3" style="width: 100%;height:400px;"></div>
</div>
</section>
</div>
{#----------页脚----------#}
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-6 footer-links">
<h4>快速了解我们</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">关于我们</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">服务</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="index">首页</a></li>
</ul>
</div>
<div class="col-lg-3 col-md-6 footer-links">
<h4>服务</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影top250</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影评分</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影短评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影热评</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="#">电影统计图</a></li>
</ul>
</div>
<div class="col-lg-4 col-md-6 footer-newsletter">
<h4>关注我们</h4>
<p>输入你的邮箱,带你了解更多电影信息</p>
<form action="" method="post">
<input type="email" name="email"><input type="submit" value="订阅">
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div class="copyright">Copyright &copy;2022 xxx</div>
<div class="credits"></div>
</div>
</footer><!-- End Footer -->
</div>
<script src="static/assets/js/jquery-3.3.1.min.js"></script>
<script src="static/assets/js/bootstrap.min.js"></script>
<script src="static/assets/js/moment.min.js"></script>
<script src="static/assets/js/tooplate-scripts.js"></script>
<script src="static/assets/js/main.js"></script>
<script src="static/assets/js/echarts.min.js"></script>
{# -----------评分分布图---------------#}
<script type="text/javascript">
var dom = document.getElementById("main");
var myChart = echarts.init(dom);
var app = {};
option = null;
option = {
color: ['#4abdbd'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data:{{ rating }},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: 'num',
type: 'bar',
barWidth: '60%',
data:{{ num }}
}
]
};
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
var dom1 = document.getElementById("main1");
var myChart1 = echarts.init(dom1);
var app1 = {};
option1 = null;
option1 = {
color: ['#4EFEB3'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: {{ filmtypes_list|tojson }},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: 'num',
type: 'bar',
barWidth: '60%',
data:{{ filmtypes_num }}
}
]
};
if (option1 && typeof option1 === "object") {
myChart1.setOption(option1, true);
}
var dom2 = document.getElementById("main2");
var myChart2 = echarts.init(dom2);
var app2 = {};
option2 = null;
option2 = {
color: ['#4EFEB3'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: {{ years|tojson }},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: 'num',
type: 'bar',
barWidth: '60%',
data:{{ years_num }}
}
]
};
if (option2 && typeof option2 === "object") {
myChart2.setOption(option2, true);
}
var dom3 = document.getElementById("main3");
var myChart3 = echarts.init(dom3);
var app3 = {};
option3 = null;
option3 = {
color: ['#4EFEB3'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: {{ top10|tojson }},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: 'num',
type: 'bar',
barWidth: '60%',
data:{{ top10_num }}
}
]
};
if (option3 && typeof option3 === "object") {
myChart3.setOption(option3, true);
}
</script>
</body>
</html>
Loading…
Cancel
Save