Forumsseiten als HTML mit Python & requests herunterladen
Dies lädt Seite 1000 … Seite 1 in absteigender Reihenfolge herunter und speichert das HTML in 1000.html bis 1.html
download_forum_pages.py
import requests
for i in range(1000, 0, -1):
with open(f"{i}.html", "w") as outfile:
outfile.write(requests.get(f"https://forum.my-domain.com/showthread.php?123456-my-thread/page{i}").text)Mit Fortschrittsanzeige
download_forum_pages_with_progress.py
import requests
from tqdm import tqdm
for i in tqdm(range(1000, 0, -1)):
with open(f"{i}.html", "w") as outfile:
outfile.write(requests.get(f"https://forum.my-domain.com/showthread.php?123456-my-thread/page{i}").text)Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow