master
Your Name 3 years ago
parent 4d95104dfd
commit b4d35ec11b

Binary file not shown.

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/qi.csv" charset="GBK" />
<file url="file://$PROJECT_DIR$/qidian - 副本.csv" charset="GBK" />
<file url="file://$PROJECT_DIR$/qidian_1.csv" charset="GBK" />
<file url="file://$PROJECT_DIR$/起点.csv" charset="GBK" />
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E265" />
<option value="E231" />
<option value="E501" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/flask_keshihua.iml" filepath="$PROJECT_DIR$/.idea/flask_keshihua.iml" />
</modules>
</component>
</project>

Binary file not shown.

@ -0,0 +1,137 @@
body {
padding: 0;
margin: 0;
font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica, Arial,
sans-serif;
font-size: 14px;
color: #333;
}
.container {
width: 590px;
margin: 0 auto;
padding-top: 100px;
position: relative;
}
.container:after {
content: "";
display: block;
clear: both;
}
.container > div {
float: left;
}
.container .logo {
width: 100%;
height: 120px;
margin: 0 auto 10px;
background-position: center;
background-repeat: no-repeat;
background-size: auto 120px;
}
.container .input {
position: relative;
width: 500px;
height: 44px;
border-top: #ccc solid 1px;
border-right: none;
border-bottom: #ccc solid 1px;
border-left: #ccc solid 1px;
border-radius: 4px 0 0 4px;
}
.container .input > input {
outline: none;
border: none;
padding: 0 80px 0 10px;
margin: 0;
height: 44px;
width: 410px;
color: #333;
font-size: 16px;
border-radius: 4px 0 0 4px;
}
.container .input > input::-webkit-input-placeholder {
color: #999;
}
.container .input .picker {
width: 40px;
padding-right: 30px;
position: absolute;
top: 0;
right: 0;
height: 100%;
line-height: 44px;
cursor: pointer;
color: #999;
font-size: 12px;
text-align: right;
background-image: url("../img/down.png");
background-position: 50px center;
background-repeat: no-repeat;
user-select: none;
}
.container .input .picker-list {
list-style: none;
padding: 5px 0;
width: 100px;
position: absolute;
right: 0;
top: 50px;
margin: 0;
line-height: 26px;
font-size: 12px;
border-radius: 2px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
background-color: #fff;
display: none;
}
.container .input .picker-list > li {
padding-left: 36px;
background-position: 10px center;
background-repeat: no-repeat;
background-size: 16px auto;
}
.container .input .picker-list > li:hover {
background-color: #ebf1f5;
cursor: pointer;
}
.container .input .hot-list {
padding: 10px 0;
width: 100%;
position: absolute;
left: 0;
top: 50px;
margin: 0;
line-height: 32px;
font-size: 14px;
border-radius: 2px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
background-color: #fff;
display: none;
}
.container .input .hot-list > a {
display: block;
color: #333;
text-decoration: none;
padding: 0 10px;
overflow: hidden;
}
.container .input .hot-list > a:hover {
background-color: #f3f3f3;
}
.container .input .hot-list > a > div {
float: left;
}
.container .input .hot-list > a > div.number {
text-align: center;
width: 40px;
}
.container .search {
width: 89px;
height: 46px;
background-color: #08f;
background-image: url("../img/search.png");
background-position: center;
background-repeat: no-repeat;
border-radius: 0 4px 4px 0;
cursor: pointer;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

@ -0,0 +1,104 @@
/* 搜索 */
var helangSearch = {
/* 元素集 */
els: {},
/* 搜索类型序号 */
searchIndex: 0,
/* 火热的搜索列表 */
hot: {
/* 颜色 */
color: [
"#ff2c00",
"#ff5a00",
"#ff8105",
"#fd9a15",
"#dfad1c",
"#6bc211",
"#3cc71e",
"#3cbe85",
"#51b2ef",
"#53b0ff",
],
/* 列表 */
list: [
"作者-收藏数-类别-收藏数",
],
},
/* 初始化 */
init: function () {
var _this = this;
this.els = {
pickerBtn: $(".picker"),
pickerList: $(".picker-list"),
logo: $(".logo"),
hotList: $(".hot-list"),
input: $("#search-input"),
button: $(".search"),
};
/* 设置热门搜索列表 */
this.els.hotList.html(function () {
var str = "";
$.each(_this.hot.list, function (index, item) {
str +=
'<a href="http://127.0.0.1:5000/py'+
'" target="_blank">' +
'<div class="number" style="color: ' +
_this.hot.color[index] +
'">' +
(index + 1) +
"</div>" +
"<div>" +
item +
"</div>" +
"</a>";
});
return str;
});
/* 注册事件 */
/* 搜索类别选择按钮 */
this.els.pickerBtn.click(function () {
if (_this.els.pickerList.is(":hidden")) {
setTimeout(function () {
_this.els.pickerList.show();
}, 100);
}
});
/* 搜索类别选择列表 */
this.els.pickerList.on("click", ">li", function () {
_this.els.logo.css(
"background-image",
"url(img/" + $(this).data("logo") + ")"
);
_this.searchIndex = $(this).index();
_this.els.pickerBtn.html($(this).html());
});
/* 搜索 输入框 点击*/
this.els.input.click(function () {
if (!$(this).val()) {
setTimeout(function () {
_this.els.hotList.show();
}, 100);
}
});
/* 搜索 输入框 输入*/
this.els.input.on("input", function () {
if ($(this).val()) {
_this.els.hotList.hide();
}
});
/* 搜索按钮 */
this.els.button.click(function () {
var searchArr = ["百度", "搜狗", "必应", "谷歌"];
alert(searchArr[_this.searchIndex] + "搜索:" + _this.els.input.val());
});
/* 文档 */
$(document).click(function () {
_this.els.pickerList.hide();
_this.els.hotList.hide();
});
/* 搜索按钮 */
},
};

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

@ -0,0 +1,33 @@
from flask import Flask,render_template
import pandas as pd
app = Flask(__name__)
@app.route("/")
def index():
data = pd.read_csv("qidian.csv")
data = data.rename(columns={'类型':'name', '总数':'value'})
data = data.to_dict(orient='records')
print(data)
data_2 = pd.read_csv("qidian_2.csv")
data_2 = data_2.rename(columns={'作者': 'name', '总收藏': 'value'})
data_2 = data_2.to_dict(orient='records')
return render_template("ppp.html",data_2=data,data=data_2)
if __name__ == '__main__':
app.run(host='0.0.0.0')#外部访问
queue = []
#向列表中插入元素
queue.insert(0,1)
queue.insert(0,2)
queue.insert(0,"hello")
print(queue)
print("取一个元素:",queue.pop())
print("取一个元素:",queue.pop())
print("取一个元素:",queue.pop())

@ -0,0 +1,10 @@
类型,总数
玄幻,48506483
仙侠,37369155
都市,28193256
悬疑,12742491
历史,11036219
轻小说,9903690
科幻,8437230
武侠,1579993
奇幻,1295460
1 类型 总数
2 玄幻 48506483
3 仙侠 37369155
4 都市 28193256
5 悬疑 12742491
6 历史 11036219
7 轻小说 9903690
8 科幻 8437230
9 武侠 1579993
10 奇幻 1295460

@ -0,0 +1,12 @@
作者,总收藏
辰东,12342898
我吃西红柿,8443971
爱潜水的乌贼,8210771
老鹰吃小鸡,7987176
唐家三少,7622633
会说话的肘子,7420941
耳根,6434597
忘语,6119743
天蚕土豆,5630378
言归正传,5329706
卖报小郎君,4759642
1 作者 总收藏
2 辰东 12342898
3 我吃西红柿 8443971
4 爱潜水的乌贼 8210771
5 老鹰吃小鸡 7987176
6 唐家三少 7622633
7 会说话的肘子 7420941
8 耳根 6434597
9 忘语 6119743
10 天蚕土豆 5630378
11 言归正传 5329706
12 卖报小郎君 4759642

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>起点中文网爬虫</title>
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}">
</head>
<body>
<div class="container">
<div class="logo" style="background-image: url(img/baidu.png)"></div>
<div class="input">
<input type="text" placeholder="请输入要搜索的内容" autocomplete="off" id="search-input">
<div class="picker">爬虫</div>
<ul class="picker-list">
<li style="background-image: url(img/ico_baidu.png)" data-logo="baidu.png">百度</li>
<li style="background-image: url(img/ico_sogou.png)" data-logo="sogou.png">搜狗</li>
<li style="background-image: url(img/ico_bing.png)" data-logo="bing.png">bing</li>
<li style="background-image: url(img/ico_google.ico)" data-logo="google.png">Google</li>
</ul>
<div class="hot-list"></div>
</div>
<div class="search"></div>
</div>
<script type = "text/javascript"
src = "{{ url_for('static', filename = 'js/jquery.js') }}" ></script>
<script type = "text/javascript"
src = "{{ url_for('static', filename = 'js/index.js') }}" ></script>
<!-- <script src="js/jquery.js"></script>-->
<!-- <script type="text/javascript" src="js/index.js"></script>-->
<script type="text/javascript">
$(function () {
helangSearch.init();
})
</script>
</body>
</html>

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>爬虫可视化</title>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.3.2/echarts.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.3.3/echarts.min.js"></script>
</head>
<body>
<div id="main" style="width:1000px; height: 600px; background :pink"></div>
<div id="main_1" style="width:1000px; height: 600px; background :pink"></div>
<script>
var main = echarts.init(document.getElementById("main"))
var main_1 = echarts.init(document.getElementById("main_1"))
var option = {
backgroundColor: '#2c343c',
title: {
text: '各类小说占比',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip: {
trigger: 'item'
},
visualMap: {
show: false,
min: 1,
max: 98506483,
inRange: {
colorLightness: [0, 1]
}
},
series: [
{
name: '类型——收藏总数',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: {{data_2|tojson}}.sort(function (a, b) {
return a.value - b.value;
}),
roseType: 'radius',
label: {
color: 'rgba(255, 255, 255, 0.3)'
},
labelLine: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
},
itemStyle: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200;
}
}
]
};
main.setOption(option)
main.s
</script>
<a>
</a>
<script>
var option_1 = {
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
name: 'Author—Favorites',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '40',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data:{{data|tojson}}
}
]
};
main_1.setOption(option_1)
main_1.s
</script>
</body>
<a href="https://www.qidian.com/soushu/%E8%BE%B0%E4%B8%9C.html" target="_blank" title="" > 玄幻 </a>
<a href="https://www.qidian.com/soushu/%E8%BE%B0%E4%B8%9C.html" target="_blank" > 辰东 </a>
<a href="https://www.qidian.com/soushu/%E6%88%91%E5%90%83%E8%A5%BF%E7%BA%A2%E6%9F%BF.html" target="_blank"> 我吃西红柿 </a>
<a href="https://www.qidian.com/soushu/%E7%88%B1%E6%BD%9C%E6%B0%B4%E7%9A%84%E4%B9%8C%E8%B4%BC.html" target="_blank"> 爱潜水的乌贼 </a>
<a href="https://www.qidian.com/soushu/%E8%80%81%E9%B9%B0%E5%90%83%E5%B0%8F%E9%B8%A1.html" target="_blank"> 老鹰吃小鸡 </a>
<a href="https://www.qidian.com/soushu/%E5%94%90%E5%AE%B6%E4%B8%89%E5%B0%91.html" target="_blank"> 唐家三少 </a>
<a href="https://www.qidian.com/soushu/%E4%BC%9A%E8%AF%B4%E8%AF%9D%E7%9A%84%E8%82%98%E5%AD%90%20.html" target="_blank"> 会说话的肘子 </a>
<a href="https://www.qidian.com/soushu/%E8%80%B3%E6%A0%B9.html" target="_blank"> 耳根 </a>
<a href="https://www.qidian.com/soushu/%E5%BF%98%E8%AF%AD%20.html" target="_blank"> 忘语 </a>
<a href="https://www.qidian.com/soushu/%E5%A4%A9%E8%9A%95%E5%9C%9F%E8%B1%86%20.html" target="_blank"> 天蚕土豆 </a>
<a href="https://www.qidian.com/soushu/%E8%A8%80%E5%BD%92%E6%AD%A3%E4%BC%A0.html" target="_blank"> 言归正传 </a>
<a href="https://www.qidian.com/soushu/%E5%8D%96%E6%8A%A5%E5%B0%8F%E9%83%8E%E5%90%9B.html" target="_blank"> 卖报小郎君 </a>
</html>

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>起点爬取可视化</title>
<script src=""></script>
</head>
<body>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

@ -5,70 +5,72 @@ from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from urllib.parse import urljoin
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
# 这个是一个用来控制chrome以无界面模式打开的浏览器
# 创建一个参数对象用来控制chrome以无界面的方式打开
chrome_options = Options()
# # #后面的两个是固定写法
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
class VipCollection:
def __init__(self):
self.driver = webdriver.Chrome()
self.driver = webdriver.Chrome(options=chrome_options)
self.start_url = 'https://www.qidian.com/rank/vipcollect/'
# 打开VIP收藏榜网页
def start(self):
self.driver.get(self.start_url)
self.driver.maximize_window()
def page_request(self,j):
page = 1+j
f = open("qidain.txt", "a",encoding="utf-8")
try:
booklist=[]
dis=dict()
booklist = []
wait = WebDriverWait(self.driver, 10) # 设置网页加载超时时间10s
wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'rank-body'))) # 等待页面排行数据被加载完成
lis = self.driver.find_elements(By.XPATH,'''//*[@class='book-img-text']/ul/li''') # 小说排名列表信息
# print(lis)
# 解析列表信息获取小说名称、url、排名、收藏数
for li in lis:
data_rid = li.get_attribute('data-rid') # 直接获取li标签的data-rid属性即每一页的排名1234...20
rank = (page - 2) * 20 + int(data_rid) # 因为每一页的排名都是1、2、3、4、5...20,所以我们需要给排名进行计算
name = li.find_element(By.XPATH,"./div[@class='book-mid-info']/h2/a").text # 获取小说名称
type=li.find_element(By.XPATH,"./div[@class='book-mid-info']/p[@class='author']/a[2]").text#获取小说类别
type_1 = li.find_element(By.XPATH,"./div[@class='book-mid-info']/p[@class='author']/a[2]").text#获取小说类别
author = li.find_element(By.XPATH,"./div[@class='book-mid-info']/p[@class='author']/a[@class='name']").text # 获取小说作者
href = li.find_element(By.XPATH,"./div[@class='book-mid-info']/h2/a").get_attribute('href')
detail_url = urljoin(self.start_url, href) # 对url进行自动拼接得到完整的小说详情url
collection = li.find_element(By.XPATH,'./div[3]/div/p/span/span').text # 获取收藏数
print({'rank': rank,'name': name, 'type': type,"author":author, 'detail_url': detail_url, 'collection': collection})#
dis={'rank': rank,'name': name, 'type': type,"author":author, 'detail_url': detail_url, 'collection': collection}
booklist.append(dis)
print({'rank': rank,'name': name, 'type_1': type_1,"author":author, 'detail_url': detail_url, 'collection': collection})#
dis_1 = {'rank': rank,'name': name, 'type_1': type_1,"author":author, 'detail_url': detail_url, 'collection': collection}
booklist.append(dis_1)
for k in booklist[::-1]:
k=str(k)+'\n'
for k in booklist[::-1]:#前面打开的文件与列表f = open("qidain.txt", "a",encoding="utf-8")booklist = []
k = str(k)+'\n'
f.write(k)
# 定位下一页按钮,尝试点击元素直到最后一页
try:
a= self.driver.find_element(By.ID,'PAGINATION-INPUT')
a = self.driver.find_element(By.ID,'PAGINATION-INPUT')
a.clear()
a.send_keys(page)
b=self.driver.find_element(By.XPATH,'//*[@id="PAGINATION-BUTTON"]')
if page==6:
b = self.driver.find_element(By.XPATH,'//*[@id="PAGINATION-BUTTON"]')
if page == 6:
self.close()
if a:
b.click()
self.page_request(page) # 请求自己对页面进行解析
# 下一页元素不存在就捕获异常,并结束
except NoSuchElementException:
print('已经是最后一页等待5秒结束......')
print('翻页错误')
except Exception as e:
print(e)
print('退出爬虫')
# 等待5秒关闭浏览器
def close(self):
time.sleep(5)
# 等待5秒关闭浏览器
self.driver.close()
@ -76,5 +78,9 @@ if __name__ == '__main__':
top = VipCollection()
top.start()
top.page_request(j=1)
top.close()

File diff suppressed because it is too large Load Diff

@ -0,0 +1,200 @@
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少
辰东
爱潜水的乌贼
卖报小郎君
圣骑士的传说
耳根
言归正传
老鹰吃小鸡
黑山老鬼
会说话的肘子
J神
宅猪
会说话的肘子
我会修空调
天蚕土豆
柳岸花又明
老鹰吃小鸡
唐家三少
背着家的蜗牛
忘语
唐家三少

@ -0,0 +1,100 @@
6698489
5750676
4759642
4455258
4443635
3903780
3765874
3338779
3024757
2973291
2888577
2816149
2622490
2609403
2522796
2467429
2427249
2352865
2146465
2084118
1875155
1816940
1810908
1793357
1781995
1754223
1753873
1752011
1728646
1694980
1602730
1580035
1563291
1557420
1533731
1528192
1496052
1487186
1425926
1425916
1422060
1396137
1393050
1387062
1372411
1324841
1315431
1313834
1300814
1295675
1294467
1262871
1259426
1250307
1240242
1214731
1214531
1190090
1186242
1174180
1151731
1142161
1132166
1119367
1106374
1051506
1049208
1036852
1030194
1019721
1002148
979873
973312
965026
959397
944269
900791
881975
872965
866051
864146
857365
850698
850653
846861
846673
842871
836965
832521
819953
806277
800075
783969
782240
777704
773853
773329
766922
766522
763982

@ -0,0 +1,200 @@
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻
玄幻
玄幻
仙侠
都市
仙侠
仙侠
都市
科幻
都市
玄幻
玄幻
都市
悬疑
玄幻
都市
玄幻
玄幻
历史
仙侠
玄幻

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,88 @@
import re
import requests
from fontTools.ttLib import TTFont
from lxml import etree
fp1 = open("类型.txt", "a", encoding="utf-8")
fp2 = open("收藏数.txt", "a", encoding="utf-8")
fp3 = open("作者名.txt", "a", encoding="utf-8")
for i in range(1,2):
#url = (f'https://www.qidian.com/rank/vipcollect?page={i}')
url = ('https://www.qidian.com/rank/vipcollect/')
response =requests.get(url)
html = response.text
# 'w'只写,不存在则创建
with open('解密前.html', mode='w', encoding='utf-8') as f:
f.write(html)
# 代码下载字体文件
with open('解密前.html', mode='r', encoding='utf-8') as f:
html = f.read()
# 正则匹配需要下载的字体文件下载地址
font_url = re.findall("\('eot'\); src: url\('(.*?)'\) format\('woff'\)", html)[0] # 目的是获取字体文件链接
# print(font_url)
#font_url = ('https://qidian.gtimg.com/qd_anti_spider/fTDYLCSL.woff')
# 下载
font_response = requests.get(font_url)
font_path = font_url.split('/')[-1] # 用split将/之间分隔开取最后一个元素将字体文件链接中的piQOMNSL.woff提取出来给font_path命名
with open(font_path, mode='wb') as f: # 二进制
f.write(font_response.content)
# 用fonttools查看字体源码
# font_path = 'piQOMNSL.woff'
fi = TTFont(font_path) # 打开当前目录的font_path文件也就是”piQOMNSL.woff“
fi.saveXML('font.xml') # 另存为font.xml
# 解析到字体,并将英文替换为数字
font_map = fi['cmap'].getBestCmap()
d = {
'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5', 'six': '6', 'seven': '7',
'eight': '8', 'nine': '9', 'zero': '0', 'period': '.'
}
# 将字典的值从英文转换为数字
for key in font_map.keys():
# key:100070
# font_map[key]: 'key'
# d[font_map[key]]: '5'
font_map[key] = d[font_map[key]]
# font_map字典,将网页中的加密内容替换为破解的数字
for key, value in font_map.items():
# print(key,value)
html = html.replace('&#' + str(key) + ';', str(value))
with open('解密后.html', mode='w', encoding='utf_8') as f:
f.write(html)
# 用xpath提取html中解密的信息
html = etree.HTML(open('解密后.html', 'r', encoding='utf-8').read())
#h2是小说类型
h2 = html.xpath('''//*[@id="book-img-text"]/ul/li['j']/div[2]/p[1]/a[2]/text()''')
#h1是小说的收藏量
h1 = html.xpath('''//*[@id="book-img-text"]/ul/li['j']/div[3]/div/p/span/span/text()''')
# h0是小说的作者名
h0 = html.xpath('''//*[@id="book-img-text"]/ul/li['j']/div[2]/p[1]/a[1]/text()''')
h3 = h2
h4 = h1
h = h0
#循环h3列表输出元素
for k in h3[::1]:
k = str(k) + '\n'
fp1.write(k)
#同理
for e in h4[::1]:
e = str(e) + '\n'
fp2.write(e)
for q in h[::1]:
q = str(q) + '\n'
fp3.write(q)
Loading…
Cancel
Save