당신의 XPath를 작동하지 않는 것입니다. 경우
//div[contains(@class,"ytp-thumbnail")]/@style
반환
style="background-image: url(https://i.ytimg.com/vi_webp/lm5CLm4ciQg/hqdefault.webp);"
만 값을 원하는 당신을 : 그것은 모두
//div[@class = "ytp-thumbnail html5-stop-propagation"]/@style
를 사용하거나 클래스 속성 contains()
ytp-thumbnail
이 경우 단지 확인 일치 있는지 확인할 수 있습니다 이용 가능 string()
:
string(//div[contains(@class,"ytp-thumbnail")]/@style)
,
반환
background-image: url(https://i.ytimg.com/vi_webp/lm5CLm4ciQg/hqdefault.webp);
그리고 경우에 당신은 URL의 값이, 당신이
substring-before()
및
substring-after()
을 사용할 수 원하는 : 추가
https://i.ytimg.com/vi_webp/lm5CLm4ciQg/hqdefault.webp
참고 것을
substring-before(substring-after(string(//div[contains(@class,"ytp-thumbnail")]/@style),'url('),')')
반환하여 끝 부분의 /
때문에 XPath가 작동하지 않음 - 대신- /@style
을 사용할 때 XPath에서 이미 스타일 속성을 선택 했으므로