Skip to content

How to extract JS links? #670

Answered by ziflex
mlen108 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, with new features, here is a working query:

LET url = 'https://nissan.catalogs-parts.com/#{client:1;page:detail;lang:ru;catalog:el;detail:28913bm410}'
LET doc = DOCUMENT(url, true)

LET panelSelector = 'div.panel-group'
LET rowSelector = 'table tr'
LET mainWaitSelector = panelSelector + ' ' + rowSelector

// wait for data
WAIT_ELEMENT(doc, mainWaitSelector)

// gathering rows with accurate CSS selectors
LET rows = (
   FOR accordion IN ELEMENTS(doc, panelSelector)
       FOR row, idx IN ELEMENTS(accordion, rowSelector)
           LET num = idx + 1
           RETURN '#' + accordion.attributes.id + ' ' + rowSelector + ':nth-child('+num+')'

)

LET count = LENGTH(rows)
LET tableSelector …

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ziflex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type/question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #102 on September 20, 2021 00:33.