hello thank you all for your reply I rewrote my code but it still does not work. webpage only has 50 pages but the code continues to crawl even after 50th page. Could you help me if anything is wrong with my code?
import os
import time import requests
def crawling(): front = 'https://currydb.supleks.jp/search?page=' behind = '&state=tokyo&city=&order=point&station-id=0' os.mkdir('curry2html_files') # i is page number i = 1 while True: r = requests.get(front + str(i) + behind) time.sleep(1) if r: print(str(i) + " th page crawling") with open("curry2_html_files/result"+str(i)+".html","w",encoding="utf-8") as f: f.write(r.text) i+=1 else: break
if name == 'main': print("start crawling") crawling() print("crawling completed")