The problem in my case is as i shown in code that nodes are similar but sometimes can have an extra parent element (in this example h5 tag) to link. One of my ideas was to get the same part of each node and than make something like this: