Linguee_webscraper/main.py

15 lines
339 B
Python
Raw Normal View History

2024-04-01 00:58:05 +02:00
import requests
from lxml import html
url = 'https://www.linguee.fr/francais-anglais/search'
params = {
'qe': 'a',
'ch': 0
}
text = requests.get(url, params = params).text
#print(text)
tree = html.fromstring(text)
items = tree.xpath('//div[@class="main_item"]')
#print(len(items))
for item in items:
print(item.text_content())