diff --git a/README.md b/README.md index 4e4f92549b7bbf1c03bab40b9e7661219a8d203d..79afb62798875ac94efd4cd097d5d7b940936933 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ 12. [爬虫训练场项目,jinja2 模板继承,项目继续迭代](https://dream.blog.csdn.net/article/details/128452409) 13. [爬虫训练场集成文件采集案例,来学习一下怎么实现的](https://blog.csdn.net/hihell/article/details/128465888) 14. [UserAgent 反爬是如何实现的,来看看这篇博客 &](https://blog.csdn.net/hihell/article/details/128473575) +15. [我是怎么用一个特殊 Cookie ,限制住别人的爬虫的](https://blog.csdn.net/hihell/article/details/128474849) +16. [你很勇哦,这么点数据就敢用异步加载?](https://blog.csdn.net/hihell/article/details/128474866?spm=1001.2014.3001.5501) +17. [老板让我手动控制网页渲染速度,说这能反爬虫?我信了。](https://blog.csdn.net/hihell/article/details/128474887?spm=1001.2014.3001.5501) ## 小知识点补充博客 diff --git a/app/__init__.py b/app/__init__.py index e1e02b17ddc2e6bb439a746c938dc98dfb1f1d36..57593e8f64bb5eabe1032e8658f5443b0b89f5fb 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -17,8 +17,9 @@ from .school.index import * from .file.index import * from .antispider.index import * from .csdn.index import * - +from .slow.index import * app.register_blueprint(s) app.register_blueprint(f) app.register_blueprint(antispider) -app.register_blueprint(cs) \ No newline at end of file +app.register_blueprint(cs) +app.register_blueprint(slow) \ No newline at end of file diff --git a/app/__pycache__/__init__.cpython-36.pyc b/app/__pycache__/__init__.cpython-36.pyc index b7eab6f38606105d2b8fe18430e4aa020b7fa193..a2b9167188d30a002e4ec227876abc1cd5605f82 100644 Binary files a/app/__pycache__/__init__.cpython-36.pyc and b/app/__pycache__/__init__.cpython-36.pyc differ diff --git a/app/csdn/__pycache__/index.cpython-36.pyc b/app/csdn/__pycache__/index.cpython-36.pyc index 86dc65a9e3141cd27ccfea31980e1b8404f16386..44708f22e64ecfa0d68d6da55e8440d26ca9a879 100644 Binary files a/app/csdn/__pycache__/index.cpython-36.pyc and b/app/csdn/__pycache__/index.cpython-36.pyc differ diff --git a/app/csdn/index.py b/app/csdn/index.py index 56f90347b2bc74bc3f207f3e6a56356e1d8847e6..71934733b2c38a3cd085f4db9fe2355315213b32 100644 --- a/app/csdn/index.py +++ b/app/csdn/index.py @@ -10,13 +10,46 @@ cs = Blueprint('csdn', __name__, url_prefix='/csdn') @cs.route('/blogstar') def user_list(): - user = Csdn.query.order_by(-Csdn.totalScore).all() + user = [] + page = request.args.get("page", 0) + try: + page = int(page) + except Exception as e: + return "what are you 弄啥嘞? 返回首页", 403 + if page == 0: + user = Csdn.query.order_by(-Csdn.totalScore).all() + elif page == 1: + user = Csdn.query.filter(Csdn.cateName == "IT其他").order_by(-Csdn.totalScore).all() + elif page == 2: + user = Csdn.query.filter(Csdn.cateName == "前端").order_by(-Csdn.totalScore).all() + elif page == 3: + user = Csdn.query.filter(Csdn.cateName == "后端").order_by(-Csdn.totalScore).all() + + elif page == 4: + user = Csdn.query.filter(Csdn.cateName == "大数据与算法").order_by(-Csdn.totalScore).all() + + elif page == 5: + user = Csdn.query.filter(Csdn.cateName == "云原生与云平台").order_by(-Csdn.totalScore).all() + elif page == 6: + user = Csdn.query.filter(Csdn.cateName == "前沿技术").order_by(-Csdn.totalScore).all() + elif page == 7: + user = Csdn.query.filter(Csdn.cateName == "人工智能").order_by(-Csdn.totalScore).all() + elif page == 8: + user = Csdn.query.filter(Csdn.cateName == "运维与安全").order_by(-Csdn.totalScore).all() + elif page == 9: + user = Csdn.query.filter(Csdn.cateName == "移动开发").order_by(-Csdn.totalScore).all() + + elif page == 10: + user = Csdn.query.filter(Csdn.cateName == "物联网与嵌入式").order_by(-Csdn.totalScore).all() + for u in user: if u.regtime is not None: u.star = "博客新星" if u.regtime.startswith("2022") else "博客之星" else: u.star = "---" - return render_template('csdn/blogstar.html', user=user) + + bg_green = 200 if page == 0 else 10 + return render_template('csdn/blogstar.html', user=user,bg_green=bg_green) @cs.route('/newstar') diff --git a/app/slow/__init__.py b/app/slow/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/slow/__pycache__/__init__.cpython-36.pyc b/app/slow/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..700167e1c28606a6cae85cb5eda46a2bb2326b28 Binary files /dev/null and b/app/slow/__pycache__/__init__.cpython-36.pyc differ diff --git a/app/slow/__pycache__/index.cpython-36.pyc b/app/slow/__pycache__/index.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..505d704ff28285a837cb63a17d81ffa81855c6ec Binary files /dev/null and b/app/slow/__pycache__/index.cpython-36.pyc differ diff --git a/app/slow/index.py b/app/slow/index.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8e474a31333c2010534f448c4b75c8c9b3130f --- /dev/null +++ b/app/slow/index.py @@ -0,0 +1,71 @@ +import math + +from flask import Blueprint, jsonify, request +from flask import render_template +import time +slow = Blueprint('slow', __name__, url_prefix='/slow') + +movies = [{ + "name": "无间道", + "release_time": "2002年12月12日", + "company": "寰亚电影发行公司", + "movie_type": "剧情、犯罪、警匪" +}, { + "name": "青蛇", + "release_time": "1993年11月4日", + "company": "香港思远影业公司", + "movie_type": "奇幻" + +}, { + "name": "喜剧之王", + "release_time": "1999年02月13日", + "company": "星辉海外有限公司", + "movie_type": "剧情、喜剧、爱情" + +}, { + "name": "重庆森林", + "release_time": "1994年07月14日", + "company": "泽东电影有限公司", + "movie_type": "剧情、悬疑、爱情" + +}, { + "name": "英雄本色", + "release_time": "1986年8月2日", + "company": "新艺城影业有限公司", + "movie_type": "剧情、动作、犯罪、惊悚" + +}, { + "name": "倩女幽魂", + "release_time": "1987年7月18日", + "company": "新艺城影业有限公司", + "movie_type": "爱情、奇幻、武侠、古装" +}, { + "name": "花样年华", + "release_time": "2000年9月29日", + "company": "泽东电影公司", + "movie_type": "剧情、文艺、爱情" +}, { + "name": "大话西游系列", + "release_time": "1995年2月4日", + "company": "彩星电影公司", + "movie_type": "喜剧、爱情、动作、奇幻、冒险" +}, { + "name": "东成西就", + "release_time": "1993年2月5日", + "company": "泽东电影公司", + "movie_type": "喜剧" +}] + + +@slow.route('/list') +def list_slow(): + return render_template('slow/index.html') + + +@slow.route('/detail') +def detail(): + movie_id = int(request.args.get("movie_id", 1)) + movie = movies[movie_id - 1] + time.sleep(5) # 延迟 5 秒 + + return jsonify(movie) diff --git a/app/static/images/movie/1.jpg b/app/static/images/movie/1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..83d781463da7ad759ff663673ae463ecce09eb1a Binary files /dev/null and b/app/static/images/movie/1.jpg differ diff --git a/app/static/images/movie/2.jpg b/app/static/images/movie/2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..60466b2c25259913e60b2f3c6258556564dab4ed Binary files /dev/null and b/app/static/images/movie/2.jpg differ diff --git a/app/static/images/movie/3.webp b/app/static/images/movie/3.webp new file mode 100644 index 0000000000000000000000000000000000000000..a4c943b73ce180698d19d036732eac26c4b7fc81 Binary files /dev/null and b/app/static/images/movie/3.webp differ diff --git a/app/static/images/movie/4.webp b/app/static/images/movie/4.webp new file mode 100644 index 0000000000000000000000000000000000000000..b2193789104b9c65fff6f9462ba98459221a5e82 Binary files /dev/null and b/app/static/images/movie/4.webp differ diff --git a/app/static/images/movie/5.webp b/app/static/images/movie/5.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0b5c3d07504de798b822f30df1b4eb563b2fc51 Binary files /dev/null and b/app/static/images/movie/5.webp differ diff --git a/app/static/images/movie/6.webp b/app/static/images/movie/6.webp new file mode 100644 index 0000000000000000000000000000000000000000..7bd157d71dfb8d6f7353ccff17ab58a492a9d72f Binary files /dev/null and b/app/static/images/movie/6.webp differ diff --git a/app/static/images/movie/7.webp b/app/static/images/movie/7.webp new file mode 100644 index 0000000000000000000000000000000000000000..a3be127cb3787d184d781ad0db92832f7068d00a Binary files /dev/null and b/app/static/images/movie/7.webp differ diff --git a/app/static/images/movie/8.webp b/app/static/images/movie/8.webp new file mode 100644 index 0000000000000000000000000000000000000000..2529ca64512ba75913c1a6d47268c96dcbe56f2d Binary files /dev/null and b/app/static/images/movie/8.webp differ diff --git a/app/static/images/movie/9.jpg b/app/static/images/movie/9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c868645c2bfa764e5e695b00c7c3680f45f980c9 Binary files /dev/null and b/app/static/images/movie/9.jpg differ diff --git a/app/templates/blog.html b/app/templates/blog.html index 11ad1c7a0d8a5b1c2072bddc8b7e7564cf7bf962..fd8d8a5d20c0a590640ac23b81362768753925e7 100644 --- a/app/templates/blog.html +++ b/app/templates/blog.html @@ -38,6 +38,15 @@ class="list-group-item list-group-item-action">13. 爬虫训练场集成文件采集案例,来学习一下怎么实现的 14. UserAgent 反爬是如何实现的,来看看这篇博客 & + + 15. 我是怎么用一个特殊 Cookie ,限制住别人的爬虫的 + + 16. 你很勇哦,这么点数据就敢用异步加载? + + 17. 老板让我手动控制网页渲染速度,说这能反爬虫?我信了。 diff --git a/app/templates/csdn/blogstar.html b/app/templates/csdn/blogstar.html index 170fe284bab48a24701c40e13d92177dc0e5c688..0a753c89e55e09077df14383c4766b86627496ff 100644 --- a/app/templates/csdn/blogstar.html +++ b/app/templates/csdn/blogstar.html @@ -6,7 +6,7 @@
CSDN 2022 博客之星总排名 👉 绿色背景是总分前 200(晋级区)👈
-数据同步时间:2022-12-30 9:00
+数据同步时间:2023-01-02 18:00
来都来了,不去给橡皮擦打个5分么? | https://bbs.csdn.net/topics/611387187
@@ -17,6 +17,19 @@ 仅看新星本案例用于大家学习文件和视频文件内容采集,重点掌握 M3U8 格式视频下载,掌握二进制内容保存。
@@ -95,6 +93,31 @@+ 作为香港警探电影系列的巅峰之作,无间道由刘德华、梁朝伟、黄秋生等实力影帝主演,它作为刘德华十大经典电影之一,主要讲述了黑社会的卧底故事,情节反转再反转,非常值得重复观看。
+ + +青蛇是由徐克执导的奇幻爱情片,该片由两大女神张曼玉和王祖贤领衔主演,青蛇对白娘子和许仙传统的爱情故事进行改变,是当年风格比较前卫的奇幻片。
+ +喜剧之王是由周星驰执导并主演的喜剧电影,该影片延续了星爷无厘头喜剧风格,前半部分笑点很多,影片结尾给人一种温暖的感觉,它是一部成功的喜剧电影。
+ +重庆森林讲述了破案警察和神秘女杀手之间的爱情故事,由林青霞、梁朝伟主演,该片的色彩丰富,格调优美,在当年获得金像奖最佳影片等奖项。
+ +1986年上映的英雄本色,是当年非常成功的商业片,该片是当年香港票房冠军,主要讲述了三个主人公闯荡江湖并产生的的兄弟情义。
+ +1986年上映的倩女幽魂,是由张国荣和王祖贤领衔主演的奇幻爱情片,该片采用聊斋中的传统故事,再加上大胆的情节改变,获得了众多粉丝的喜爱。
+ +花样年华是2000年上映的香港电影,该影片带有浓烈的王家卫风格,影片中的色彩运用到极致,再加上中国旗袍的古典美,该影片获得众多奖项。
+ ++ 这是最早的穿越电影之一,主要讲述了至尊宝和紫霞仙子之间的情缘,该片在上映之时,并没有获得很多的关注,直到两年后才在高校学生之间蹿红,肯定是在香港十大经典电影推荐之中。
+ +1993年上映的东成西就,是由刘镇伟执导的喜剧片,该片巨星云集,主演有张国荣、张学友、梁朝伟、梁家辉、张曼玉、林青霞等。
+ +