From b8ab2f09fce6d883e01a3d52331c12d12aa4f753 Mon Sep 17 00:00:00 2001 From: xingzhibang <775288271@qq.com> Date: Mon, 24 Aug 2026 11:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=94=E8=B6=A3=E9=98=81=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 +++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++++ .idea/misc.xml | 7 ++++++ .idea/modules.xml | 8 +++++++ .idea/pythonProject1.iml | 8 +++++++ .idea/vcs.xml | 6 +++++ text.py | 23 +++++++++++++++++++ 7 files changed, 66 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/pythonProject1.iml create mode 100644 .idea/vcs.xml create mode 100644 text.py 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}") + +