class mangabz:
url = "http://image.mangabz.com/1/430/19894/{}" # {}缺少页码编号
jpg_params = {
"cid": "19894",
"key": "40b7dead39f489ec4b0c2212e793b1f2",
"uk": ""
}
ajax_api = "http://www.mangabz.com/m19894/chapterimage.ashx?"
api_params = {
"cid": "19894",
"page": "0",
"key": "",
"_cid": "19894",
"_mid": "430",
"_dt": "2020-08-09 21:46:28",
"_sign": "2c617649c5b75aefa56a28c91cd6ad1c"
}
def get_nex_page(self, page):
# 根据页码,获取当前页码的编号,以及下一个页码的编码
self.api_params["page"] = page
response = requests.get(self.ajax_api, params=self.api_params)
pages = re.findall("\d{1,2}_\d{4,5}", response.text)
self.pt_jpg_url(pages)
def pt_jpg_url(self, pages):
on, next = pages
print(self.url.format(on))
print(self.url.format(next))
if __name__ == '__main__':
t = mangabz()
t.get_nex_page(1)
|