Skip to content
Advertisement

how to scrape all items of a page using a loop

i’m trying to scrape and list 24 items from a certain website. instead, it shows the same item 24 times.

to get the first price i did this:

JavaScript

as said, it does print 24 lines. but instead of listing all the different ones, it just lists the first result (probably because the i = 0). i’m very bad at coding so I don’t know what to change to get the wanted result. any thoughts?

Advertisement

Answer

Try the below code.

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement