Skip to content
Advertisement

scraping multiple tags at once

I’m trying to scrape the imdb top 250 movies and I want to get all the links of those movies from this page https://www.imdb.com/chart/top/ I tried

JavaScript

but I’m only getting the first link only, so my question is how to scale this code to include the whole list of 250 movies?

Advertisement

Answer

bs.find('td',{'class':'titleColumn'}) gives you the first entry, and find_all('a') gives you all the <a> tags under that entry. To find all the entries you can use

JavaScript

If you still want to iterate over the titles list and extract more information you need to locate all the titles and extract <a> from each one

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