ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
338 stars 37 forks source link

Rebuild a link from EAN number #589

Closed Parvares closed 1 year ago

Parvares commented 1 year ago

Hi Mike, with your extension I'm trying to reach these links starting from the EAN number:

EAN: 9788830104969 ----> LINK: https://www.ibs.it/m-ultimi-giorni-dell-europa-libro-antonio-scurati/e/9788830104969

EAN: 9791259851178 ----> LINK: https://www.ibs.it/lotta-fra-titani-libro-wilbur-smith-mark-chadbourn/e/9791259851178

I tried with this template URL but it leads me to the previous page:

https://www.ibs.it/algolia-search?ts=as&query=%s&query_seo=%s&qs=true

Would it be possible? Thanks a lot!

ssborbis commented 1 year ago

The links appear to be built with titles and the EAN number in the URL.

If you search for 9788830104969 you get this result, correct?

https://www.ibs.it/algolia-search?ts=as&query=9788830104969&query_seo=9788830104969&qs=true

But you really want to open the page to the first result shown? Which is

https://www.ibs.it/m-ultimi-giorni-dell-europa-libro-antonio-scurati/e/9788830104969?queryId=75f5f8bc37f7590fe38211fcefe06878

If you can assume the extra link you want to open is always the first result in the list, you can add some Post-Search Script to automatically load that link for you after your search.

document.querySelector('.cc-listing-items a.cc-title').click();
Parvares commented 1 year ago

Wao. thanks really so much, seems magic, that was exactly what I desired!