Link Selector problem

Hello,
I want to extract links to Facebook pages from the Manta website,
On the first page(1), the page link is extracted normally, but on the second page, it gives me a link to the Instagram page, I don't know why this happens to me.

Url:
Link to the first page:
https://www.manta.com/c/mx7q5vc/dermatology-laser-surgery-center

Link to the second page:
https://www.manta.com/c/m1rx8rc/my-eye-lab-cypress

Home page linkز
https://www.manta.com/search?search=Laser%20Eye%20Surgery&context=unknown&search_source=nav&city=Houston&state=Texas&country=United%20States&pt=29.7869%2C-95.3905&device=desktop&screenResolution=1920x1080&pg=1

Sitemap:
{"_id":"manta","startUrl":["https://www.manta.com/search?search=Laser%20Eye%20Surgery&context=unknown&search_source=nav&city=Houston&state=Texas&country=United%20States&pt=29.7869%2C-95.3905&device=desktop&screenResolution=1920x1080"],"selectors":[{"id":"titlle","parentSelectors":["_root"],"type":"SelectorLink","selector":"a.hover\:text-primary-v1","multiple":true,"linkType":"linkFromHref"},{"id":"name","parentSelectors":["titlle"],"type":"SelectorText","selector":".text-black a","multiple":false,"regex":""},{"id":"facebook","parentSelectors":["titlle"],"type":"SelectorLink","selector":"li.pb-2:nth-of-type(1) a","multiple":false,"linkType":"linkFromHref"}]}


I couldn't import the sitemap, but from the fragments I can see you're using the nth selector such as :nth-of-type(1). This will make WS grab the first available field, which seems to change (Facebook is not always first). You can improve it with something like:

Type: Link
Selector: ul > li:contains('Facebook') a

You can change the :contains as needed to match other fields.

1 Like

It works thank you very much :slight_smile:

1 Like