Skip to content

Commit 8d5dc5b

Browse files
author
Taois
committed
fix: 修复七猫小说不能翻页和部分图片不显示问题
1 parent 6356f8a commit 8d5dc5b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

spider/py/七猫小说[书].py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ def categoryContent(self, tid, pg, filter, extend):
9898
api_url = f'{self.host}/shuku/fyclass-fyfilter-fypage/'
9999
url = api_url.replace('fyclass', str(tid)).replace('fyfilter', filter_url).replace('fypage', str(pg))
100100
url = self.jinja_render(url, fl=extend)
101+
url1 = "{{host}}/qimaoapi/api/classify/book-list?channel={{tid}}&category1={{fl.作品分类 or 'a'}}&category2=a&words={{fl.作品字数 or 'a'}}&update_time={{fl.更新时间 or 'a'}}&is_vip=a&is_over={{fl.是否完结 or 'a'}}&order={{fl.排序 or 'click'}}&page={{page}}"
102+
url1 = self.jinja_render(url1, fl=extend, host=self.host, tid=tid, page=pg)
101103
print('url:', url)
104+
print('url1:', url1)
102105
r = requests.get(url, headers=self.headers)
103106
html = r.text
104107
d = []
@@ -119,11 +122,21 @@ def categoryContent(self, tid, pg, filter, extend):
119122
"vod_pic": pd(it, 'img&&src'),
120123
"vod_content": pdfh(it, '.s-desc&&Text'),
121124
})
125+
try:
126+
r = requests.get(url1, headers=self.headers)
127+
json = r.json()
128+
book_list = json['data']['book_list']
129+
for book in d:
130+
book_extra = [x for x in book_list if x.get('read_url') == book['vod_id']]
131+
if len(book_extra) == 1:
132+
book['vod_pic'] = book_extra[0].get('image_link') or book['vod_pic']
133+
except Exception:
134+
pass
135+
122136
result = {}
123-
pagecount = 1
124-
limit = 20
125-
total = 9999
126-
videos = []
137+
pagecount = 999 # 设置为1就只能1页不能翻页
138+
limit = 15 # 一页多少
139+
total = 999999
127140
result['list'] = d
128141
result['page'] = pg
129142
result['pagecount'] = pagecount

0 commit comments

Comments
 (0)