0
votes

Gratter les liens d'URL avec python

Voici mon code:

from selenium import webdriver
from bs4 import BeautifulSoup

driver = webdriver.Firefox()
url = 'https://www.coteur.com/cotes-foot.php'
driver.get(url)

links = driver.find_elements_by_xpath('//a[contains(@href, "match/cotes-")]')

driver.close()


1 commentaires

Qu'est-ce que tu as essayé jusqu'à présent?


3 Réponses :


0
votes

Essayez ceci:

if 'soccer' in tag.get("href", None):
    print(tag.get("href", None))



0 commentaires

0
votes

J'ai essayé ceci: xxx

voici la sortie: xxx


0 commentaires

1
votes

Vous obtenez des webelements avec Find_elements_by_xpath Vous devez obtenir href à partir de ce xxx


0 commentaires