Сам сайт:
https://series.naver.com/comic/recentList.series
Если выйти за пределы пагинации возращает на последнию страницу
До чего додумался:
page_iteration = False
books_dict = []
total_page = 0
while page_iteration != True:
total_page += 1
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get(f"https://series.naver.com/comic/recentList.series?page={total_page}") as response:
html = await response.text()
soup = BeautifulSoup(html, "lxml")
books_block = soup.find_all("ul", "lst_thum")
for block in books_block:
books = block.find_all("li")
for book in books:
book_url = "https://series.naver.com" + book.find("a", "NPI=a:content").get("href")
books_dict.append({"book_url": book_url})
with open("result.json", "a", encoding="utf-8") as file:
json.dump(books_dict, file, indent=4, ensure_ascii=False)