XPath грабим ссылку в Google Table

На странице есть код, мне нужно извлечь ссылки на spotify и apple. В коде страницы попадается еще много всяких разных ссылок.

<a href="https://open.spotify.com/album/3SSrh5r6ZphtTUQW4Bk8Y">
<div class="hyperFollowDspLink">
<div>
<img src="/images/page/spotify.svg" class="hyperFollowDspIcon">
<span class="pageButton">
<div style="float:right;line-height: 40px;">
<i class="fa fa-angle-double-right" aria-hidden="true"></i>
</div>
<div style="float:right;font-size:17px;margin-top:2px;font-weight:bold;margin-right:10px;line-height: 40px;">
</div>
</span>
</div>
</div>
</a>
<a href="https://music.apple.com/us/album/single/15030032?uo=4">
<div class="hyperFollowDspLink">
<div>
<img src="/images/page/applemusic.svg" class="hyperFollowDspIcon">

Я делаю так:

=IMPORTXML(A1;"//@href")

где A1 это ссылка на страницу. Таким образом мне выдаются все ссылки с страницы, а нужны только нужные.


Ответы (1 шт):

Автор решения: Alexey R.

Добавьте условий в Ваш xpath:

//a[starts-with(@href, 'https://open.spotify.com') or starts-with(@href, 'https://music.apple.com')]/@href
→ Ссылка