Skip to content Skip to sidebar Skip to footer

How To Get Beautiful Soup To Get Link From Href And Class?

I'm writing a script to download multiple FLACs from a website, and I'm using Beautiful Soup to get the flac link and downloading the links with urlopen I want BS to search for a l

Solution 1:

Your code is trying to match on an id attribute that doesn't exist in the anchor tags linking to those flacs.

Instead use a regex to match href's that end in .flac:

t = soup.find_all(href=re.compile(".flac$"))

Post a Comment for "How To Get Beautiful Soup To Get Link From Href And Class?"