Get data (tile & answer) in one row/record id without any wrapper element

I'm already struggling with this for years, and I still didn't find a solution.
The page I'm trying to scrape doesn't use any element that I can use as a wrapper.
As a result each title and answer gets its own row in the csv, instead of one.
Of course I want the title and corresponding answer in the same row/record.

Who knows how to solve this puzzle?

Url: Vragen over internationale treintickets | NMBS Internationaal

Sitemap:
{"_id":"nmbs_fr","startUrl":["https://www.b-europe.com/NL/Veelgestelde-Vragen"],"selectors":[{"delay":0,"id":"cat_link","multiple":false,"parentSelectors":["cat_element"],"selector":"a.sel-faq-category-detailpage","type":"SelectorLink"},{"delay":0,"id":"cat_element","multiple":true,"parentSelectors":["_root"],"selector":"div.faq-category-item","type":"SelectorElement"},{"delay":0,"id":"title","multiple":true,"parentSelectors":["cat_link"],"regex":"","selector":"header.rt-collapse","type":"SelectorText"},{"delay":0,"id":"answer","multiple":true,"parentSelectors":["cat_link"],"regex":"","selector":"section","type":"SelectorHTML"}]}

1 Like

Hi Ramonhak

Thanks for posting this puzzle it was fun! I fixed your sitemap by making a 1 change.

The problem was you have both "title" and "cat_element" with the condition "multiple"=true.

If you make title "multiple"=true and the rest "multiple"=false then all will be 1-1 with "title".

Sitemap

{"_id":"beurope","startUrl":["https://www.b-europe.com/NL/Veelgestelde-Vragen"],"selectors":[{"delay":0,"id":"cat_link","multiple":false,"parentSelectors":["cat_element"],"selector":"a.sel-faq-category-detailpage","type":"SelectorLink"},{"delay":0,"id":"cat_element","multiple":true,"parentSelectors":["_root"],"selector":"div.faq-category-item","type":"SelectorElement"},{"delay":0,"id":"title","multiple":true,"parentSelectors":["cat_link"],"regex":"","selector":"header.rt-collapse","type":"SelectorText"},{"delay":0,"id":"answer","multiple":false,"parentSelectors":["cat_link"],"regex":"","selector":"section","type":"SelectorHTML"}]}

I'm totally flabbergasted :-))) Was this really this easy?? Hahaha, would have never thought of this solution.
Many, many thanks for your help!!! Really appreciate it!!

All the best,
Ramon

1 Like

Oh I'm so sorry, but after taking a closer look I see now that your solution didn't work out correctly.
I do see Titles and Answers, the problem is only that those are not the rights answers :wink:

It screws up the data by not ordering it correctly, unfortunately

Do you know what to do @csabour ?

1 Like

I'll take a closer look. Haha @flabergasted