-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrule.toml
165 lines (123 loc) · 6.19 KB
/
rule.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
[[websites]]
netloc = "www.xbookcn.com"
# 空 就是 None
encoding = "big5"
# body_page 是正文获取规则
[websites.body_page]
loader = 'aiohttp'
[websites.body_page.title]
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'div[class=title_page]'
kwargs.attributes = [['_get_text'],] # 详见 parse_rule/lower_rule.LxmlCssSelectorRule
[[websites.body_page.content]]
type = 'BodyPageContentLxmlCssElementRule'
kwargs.str_pattern = "div[class=content] > p"
kwargs.attributes = [['_get_content'],]
[websites.body_page.content_other_settings]
traditional2simplified_chinese = true
[[websites.body_page.next_page_url]] # 原因是有的网站不光有下一章,还有下一页(更细粒度)
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'a[href=index\.htm] + a'
kwargs.attributes = [['_get_attribute', 'href']]
# index_page 是目录获取规则
[websites.index_page]
loader = 'aiohttp'
[[websites.index_page.content]] # 与正文页面统一
type = 'LxmlCssElementRule'
kwargs.str_pattern = "div[class=TitleLinks] div[class=content] > a"
kwargs.attributes = [['_get_attribute', 'href'], ['_get_text']]
[[websites.index_page.next_page_url]] # 与正文页面统一
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'none[class=none]' # 随便写的,这里没有下一页
kwargs.attributes = []
[[websites]]
netloc = "m.haohengwx.com"
[websites.body_page]
loader = 'playwright'
[websites.body_page.title]
type = 'PlaywrightElementRule'
kwargs.str_pattern = 'h1[id=chaptertitle]'
kwargs.attributes = [['_get_text'],]
[[websites.body_page.content]]
type = 'BodyPageContentPlaywrightElementRule'
kwargs.str_pattern = "div[class=articlecontent] > div > p"
kwargs.attributes = [['_get_content_with_img', 'img', 'src'],]
[websites.body_page.content_other_settings]
try_combine_fake_paragraphs = true # 不少小说网站乱切分自然段,这里根据每个“自然段”最后一个 word 尝试进行合并
[[websites.body_page.next_page_url]] # 原因是有的网站不光有下一章,还有下一页(更细粒度)
type = 'PlaywrightElementRule'
kwargs.str_pattern = '//ul/li[position()=4]/a[substring(@href, string-length(@href) - 3) = "html"][contains(text(), "下一页")]'
kwargs.attributes = [['_get_attribute', 'href']]
[[websites.body_page.next_page_url]] # 原因是有的网站不光有下一章,还有下一页(更细粒度)
type = 'PlaywrightElementRule'
kwargs.str_pattern = '//ul/li[position()=4]/a[substring(@href, string-length(@href) - 3) = "html"][contains(text(), "下一章")]'
kwargs.attributes = [['_get_attribute', 'href']]
[websites.index_page]
loader = 'aiohttp'
[[websites.index_page.content]] # 与正文页面统一
type = 'LxmlCssElementRule'
kwargs.str_pattern = "ul[class=chapters] > li > a"
kwargs.attributes = [['_get_attribute', 'href'], ['_get_text']]
[[websites.index_page.next_page_url]] # 与正文页面统一
type = 'LxmlXpathElementRule'
kwargs.str_pattern = '//div[@class="page"]/a[contains(text(), "下一")]'
kwargs.attributes = [['_get_attribute', 'href']]
[[websites]]
netloc = "www.hejixs.com"
encoding = "utf8"
[websites.body_page]
loader = 'playwright'
[websites.body_page.title]
type = 'PlaywrightElementRule'
kwargs.str_pattern = 'h1[class=page-title]'
kwargs.attributes = [['_get_text'],]
[[websites.body_page.content]]
type = 'BodyPageContentPlaywrightElementRule'
kwargs.str_pattern = "div[id=content] > div > p"
kwargs.attributes = [['_get_content_with_img', 'img', 'src'],]
[websites.body_page.content_other_settings]
try_combine_fake_paragraphs = true # 不少小说网站乱切分自然段,这里根据每个“自然段”最后一个 word 尝试进行合并
[[websites.body_page.next_page_url]] # 原因是有的网站不光有下一章,还有下一页(更细粒度)
type = 'PlaywrightElementRule'
kwargs.str_pattern = 'center[class=chapterPages] > a[class=curr] + a'
kwargs.attributes = [['_get_attribute', 'href']]
[[websites.body_page.next_page_url]] # 原因是有的网站不光有下一章,还有下一页(更细粒度)
type = 'PlaywrightElementRule'
kwargs.str_pattern = 'a[class=next]'
kwargs.attributes = [['_get_attribute', 'href']]
[websites.index_page]
loader = 'playwright'
[[websites.index_page.content]] # 与正文页面统一
type = 'PlaywrightElementRule'
kwargs.str_pattern = "div[class=container] > div:nth-child(9) li > a"
kwargs.attributes = [['_get_attribute', 'href'], ['_get_text']]
[[websites.index_page.next_page_url]] # 与正文页面统一
type = 'PlaywrightClickRule'
kwargs.str_pattern = 'a[class=nextPage]'
[[websites]]
netloc = "www.kunnu.com"
encoding = "utf8"
[websites.body_page]
loader = 'aiohttp'
[websites.body_page.title]
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'h1[id=nr_title]'
kwargs.attributes = [['_get_text'],]
[[websites.body_page.content]]
type = 'BodyPageContentLxmlCssElementRule'
kwargs.str_pattern = "div[id=nr1]"
kwargs.attributes = [['_get_content'],]
[[websites.body_page.next_page_url]]
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'li[class=next] > a'
kwargs.attributes = [['_get_attribute', 'href']]
[websites.index_page]
loader = 'aiohttp'
[[websites.index_page.content]] # 与正文页面统一
type = 'LxmlCssElementRule'
kwargs.str_pattern = "div[class^=book-list] li > a"
kwargs.attributes = [['_get_attribute', 'href'], ['_get_text']]
[[websites.index_page.next_page_url]] # 与正文页面统一
type = 'LxmlCssElementRule'
kwargs.str_pattern = 'none[class=none]' # 随便写的,这里没有下一页
kwargs.attributes = []