Python download mp3 from url

I'm trying to learn Python and I tried to write a code to download all the bible mp3 files from my church website where there's a list of mp3 hyperlinks such as:

Chapter 1, Chapter 2,3,4,5 and so on... Reference link

I managed to get all the mp3 URL links to show on the shell after running my code but I can't seem to be able to download them at all.

Here's my code

import requests
import urllib.request
import re
from bs4 import BeautifulSoup

r = requests.get['//ghalliance.org/resource/bible-reading']
soup = BeautifulSoup[r.content, 'html.parser']

for a in soup.find_all['a', href=re.compile['http.*\.mp3']]:
    print[a['href']]

I did try using wget but I can't seem to get wget to work on my machine running VSCode Python 3.8.1 64-bit or conda 3.7.4... I've checked both conda cmd and cmd and it showed that I had wget in my system, I even manually download the wget.exe to my system32 directory but whenever I tried to run the

wget.download[url]

I always get an error message or something like wget has no attribute 'download' or whatnot.

I read a few beginner tutorials on using selenium, wget, beautifulsoup to download simple pictures, etc but I can't seem to incorporate their method to work on this specific problem of mine...cuz I'm still too new to programming in general, so I apologize for asking stupid dumb questions like these.

But now that I had all my MP3 URL links, so my question is: how do I go about downloading them using Python?

A simple python program to download in a simple way a mp3 on mp3skull.com. Features : Search, result list, download

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

import urllib2, urllib
number_of_result = 20
def get_page[query]:
page_source = urllib2.urlopen["//mp3skull.com/mp3/{}.html".format[query.replace[" ","_"]]].read[]
return page_source
def get_link[page_source, n]:
# "n" is the position in the list in the results
result_start = '
'
pos1 = page_source.find[result_start.format[n]] #The position at which the source code starts for a specific n result
link_indicator = '

Chủ Đề