Skip to content
Advertisement

Python bs4: select specific links in soup

I know similar questions were asked before but no adaptation of other solutions yielded the desired result. Suppose a bs4 soup contains many elements like the one below:

JavaScript

How can I extract the link in the very first line (href=”extract_this_link”) for all elements in the soup and store them in a list?

Any help is greatly appreciated!

Advertisement

Answer

JavaScript
Advertisement