lnxpy / mdb-ai-prompted-text

MindsDB (mdb.ai) AI Single-prompting Text Using PyAction
1 stars 0 forks source link

AI: Text Prompting #26

Open lnxpy opened 1 month ago

lnxpy commented 1 month ago

Text

Create a simple Python crawler that scraps Wikipedia

Prompt

help by showing code snippets

Submission Privacy

github-actions[bot] commented 1 month 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)