Skip to content
Advertisement

How to extract link to Package Sources from Arch User Repository (AUR) website

I’m using BeautifulSoup to extract this line:

JavaScript

from a webpage.

JavaScript

Specifically, I want this part: iwgtk-0.8.tar.gz

I’ve written this code:

JavaScript

and I assume it is this line

JavaScript

that fails. I’ve tried

JavaScript

but that failed too.

Advertisement

Answer

Try to select your elements more specific:

JavaScript

or more comfortable via css selector

JavaScript

and use get('href') to get the url or text / get_text() to get its text or use both and store as key value in dict:

JavaScript

Example

JavaScript

Output

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