Open lnxpy opened 6 months ago
import requests
from bs4 import BeautifulSoup
def wikipedia_crawler(url):
response = requests.get(url)
if response.status_code == 200:
soup = BeautifulSoup(response.content, 'html.parser')
paragraphs = soup.find_all('p')
for paragraph in paragraphs:
print(paragraph.get_text())
else:
print('Failed to fetch page')
url = 'https://en.wikipedia.org/wiki/Web_crawler'
wikipedia_crawler(url)
Text
Prompt
help by showing code snippets
Submission Privacy