commit b8ab2f09fce6d883e01a3d52331c12d12aa4f753 Author: xingzhibang <775288271@qq.com> Date: Mon Aug 24 11:41:54 2026 +0800 笔趣阁初始化 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4190817 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..fdd8fdf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pythonProject1.iml b/.idea/pythonProject1.iml new file mode 100644 index 0000000..7565f90 --- /dev/null +++ b/.idea/pythonProject1.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/text.py b/text.py new file mode 100644 index 0000000..0728fd6 --- /dev/null +++ b/text.py @@ -0,0 +1,23 @@ +import os.path + +import requests +from lxml import etree +from fake_useragent import UserAgent + +class SpiderBiQuGe(object): + def __init__(self): + self.headers = { + "User-Agent":UserAgent().random + } + # 根目录 + self.BASE_DIR = os.path.dirname(__file__) + # 源码文件目录,存储爬取到的每一页的源码数据 + self.SOURCE_DIR = os.path.join(self.BASE_DIR,"novel","source") + # 文档目录,存储解析到小说的内容 + self.NOVEL_DIR = os.path.join(self.BASE_DIR,"novel","novel") + + def handler(self,file_name,mode="a",encoding="utf-8",tag="source"): + if tag == "source": + file_path = os.path.join(self.SOURCE_DIR,f"{file_name.html}") + +