Advertisement
A_GUES

Copy website

Jul 11th, 2023 (edited)
1,097
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. # Make a request to the website
  5. url = "http://www.yourwebsite.com"  # replace with your website
  6. response = requests.get(url)
  7.  
  8. # Parse the HTML content
  9. soup = BeautifulSoup(response.text, 'html.parser')
  10.  
  11. # Save the website content to a file
  12. with open("website.html", "w", encoding='utf-8') as file:
  13.     file.write(str(soup.prettify()))
  14.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement