I have a long HTML file that I’m processing through PowerQuery like so:
= Html.Table(Source, {
{"Title", ".idea-heading"},
{"Description", ".ng-binding.idea-desc"},
{"Last updated", ".sr-only"},
{"Status", ".state-icon + *"},
{"Votes", ".ng-binding:nth-child(5)"},
{"Idea categories", ".idea-category"},
}, [RowSelector="LI"])
This works well.
However, the HTML also contains <img>
tags. And I would like to extract the src
attributes of these <img>
s with PowerQuery.
How can I do that?
I’ve already tried the following queries (fully knowing that they go beyond the baseline CSS selector “language”):
"img@src"
(inspired by xPath)url(img)
Unfortunately they resulted in an Expression.Error: The string did not match the expected pattern.
Reading the manual helps; it provides this example:
Html.Table("<a href=""/test.html"">Test</a>", {{"Link", "a", each [Attributes][href]}})
So I adopted it accordingly to my use case and added this line:
{"Image", "img", each [Attributes][src]}}