Skip to content
Advertisement

Beautiful Soup has problems with amazon,it

I’m trying to take the name and the prize from amazon page, this is the code:

JavaScript

The problem is that with URL it works but with URL2 it doesn’t work. How can I fix it ?? Thanks :)

Advertisement

Answer

before getting text you have to check if you find required element and if so, you can extract text:

JavaScript

Please NOTE amazon has a few different page layouts, so if you want to make generic crawler you wil have to cover all of them

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