Add main.py

This commit is contained in:
Benjamin Loison 2024-04-01 00:58:05 +02:00
commit 8d0a889a0f
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

15
main.py Normal file
View File

@ -0,0 +1,15 @@
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())