Reputation: 2107
Current formula:
=IMPORTXML(
"https://int.soccerway.com/international/europe/uefa-cup/20202021/3rd-qualifying-round/r59325/",
"//div[@class='match-card match-hour' and ..//td[@class='score-time ']/a[contains(@href, 'matches')]]"
)
I'm trying to collect this values in //div[@class='match-card match-hour']
:
But only when @href
in //td[@class='score-time ']/a/@href]
contains the word matches
:
Example Link in Apollon 0 - 5 Lech Pozan
:
https://int.soccerway.com/matches/2020/09/23/europe/uefa-cup/apollon-limassol/kks-lech-poznan/3360423/
Note that the link contains the word matches
Why only when there is this text?
Because on some pages of this website the place where the results of the matches are located does not contain links to the match, only those with the word 'matches'.
Upvotes: 0
Views: 1744
Reputation: 201378
The HTML you want to retrieve has the structure as follows.
<td class="day ">
<div class="match-card match-hour">FT</div>
</td>
<td class="team team-a ">
<a href="/teams/cyprus/apollon-limassol/518/" class="flag_16 right_16 cyprus_16_right" title="Apollon">Apollon</a>
</td>
<td class="score-time ">
<a href="/matches/2020/09/23/europe/uefa-cup/apollon-limassol/kks-lech-poznan/3360423/">
<span class="extra_time_score">0 - 5</span>
</a>
</td>
In this case, I thought that the xpath might be //div[@class='match-card match-hour' and ../../td[@class='score-time ']/a[contains(@href, 'matches')]]
. So how about the following modified formula?
=IMPORTXML(
"https://int.soccerway.com/international/europe/uefa-cup/20202021/3rd-qualifying-round/r59325/",
"//div[@class='match-card match-hour' and ../../td[@class='score-time ']/a[contains(@href, 'matches')]]"
)
//div[../../td[@class='score-time ']/a[contains(@href, 'matches')]]
and //div[../../td[@class='score-time ']]
might be able to be also used as the xpath.Upvotes: 2