Skip to content
Advertisement

Better way of capturing multiple same tags?

I’m trying to create an scraper which scrapes download links, I want to use regex but that would be a nightmare for me to do, I’ve found this library which is called BeautifulSoup, I’m trying to capture the urls in the children of div class="article-content" which is <p> tag, and this <h3> is the name of the urls,I don’t want to combine all urls in one list but instead I used dictionary which is key is the name(<h3>) and value is the list of urls, enough of the talk here is the code.

JavaScript

so far I only managed to capture only 1 key, is there a pythonic way to do this?

Advertisement

Answer

You might want to try this:

JavaScript

The reason you have one key only is that keys have to be unique but the names of the links are not. Change this with something unique, for example, an index number or the series title with the resolution.

Sample output:

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