The first problem is easy. For each input feed, use a Rename operator rename or copy dom elements to your unified format. Then after you union all your modified input fields, you can use the unified names.
The second problem is tricky. I usually work around cases like that by using a Rename + Regex + Loop(String Builder) operators like this:
Rename the relevant fields, just so that they become easier to work with later, for example:
- Rename
item.div.div.0.div.div.a.href
tolink0
- Rename
item.div.div.1.div.div.a.href
tolink1
- Rename
item.div.div.2.div.div.a.href
tolink2
- ...
- Rename
Using a Regex, try to make the irrelevant
link0
,link1
empty, for example:- In
item.link0
replace^.*[^/]$
with nothing - In
item.link1
replace^.*[^/]$
with nothing - In
item.link2
replace^.*[^/]$
with nothing - ...
The right regex will depend on your use case. In my example this was suitable to make the irrelevant elements empty.
- In
Using a Loop, with a String Builder inside, I concatenate
item.link0
anditem.link1
and assign the result toitem.link
.
As a result, whichever link0
, link1
, ... had the right link, since all the others were emptied, the concatenated value will be the right one.
It's a hack, but it can work. I actively use this technique in some of my pipes. The tricky part is coming up with the right regex to make the irrelevant values blank.