05. [10p] Bonus: Lyrics retrieval
What else can you do easily using Python… ?
Let's try this one:
fetch the lyrics of your favorite song from
this site.
Ofc, you can do this very easy using the
requests
library!
(Note: you must first install it using
pip
).
Extract
just the lyrics part from the
HTML code and print it to the console! (also, please get rid of those
<br>
line break tags, replace them with newlines instead).
Although you could use
regular expressions for capturing the contents inside a specific
HTML tag, it's a bit overkill…
Instead: simply use the standard string search methods and Python sequence indexing / slices to accomplish this much easier ;)