Advertisement
MeowalsoMeow

web_scraper_stage3

Jun 11th, 2021
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def save_content():
  2. url = input("Input the URL:")
  3. r = requests.get(url)
  4. if r.status_code == 200:
  5. page_content = requests.get(url).content
  6. # with open('..stage4/source.html', 'wb') as file:
  7. with open('C:/Users/linyu/Documents/jetbrains_temp_files/WebScraper/stage4', 'wb') as file:
  8. file.write(page_content)
  9. print("Content saved.")
  10. else:
  11. print(f"The URL returned {r.status_code}!")
  12.  
  13.  
  14. save_content()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement