23 lines
521 B
Python
23 lines
521 B
Python
from openai import OpenAI
|
|
from copy import deepcopy
|
|
import requests, sys, os
|
|
from bs4 import BeautifulSoup
|
|
|
|
choice = 'start'
|
|
|
|
query = 'python chatgpt -stackoverflow'
|
|
url = f'https://www.bing.com/search?q={query.replace(" ", "+")}'
|
|
|
|
headers = {'User-Agent': 'Mozilla/5.0'}
|
|
response = requests.get(url, headers=headers)
|
|
|
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
links = soup.select('li.b_algo h2 a')
|
|
|
|
print('Response:')
|
|
|
|
for link in links:
|
|
print('>', link.text, '< links to ', link['href'])
|
|
|
|
print('Ok ciao')
|