Pobierz z Radio Javan Python
def get_download_link(link):
# Get media type
media_type = re.split(r"/", link)[3]
# Get File name
file_name = re.split(r"/", link)[5]
# Start session
session = requests.Session()
# get Response
response = session.get(f"https://www.radiojavan.com/{media_type}/{media_type[:-1]}_host/?id={file_name}")
base_url = str(json.loads(response.text)["host"])
# Check media data type
# podcasts
if media_type == "podcasts":
return f"{base_url}/media/podcast/mp3-256/{file_name}.mp3"
# mp3s
elif media_type == "mp3s":
return f"{base_url}/media/mp3/{file_name}.mp3"
# videos
elif media_type == "videos":
return f"{base_url}/media/music_video/hq/{file_name}.mp4"
else:
return None
########## Test ###########
get_download_link('https://www.radiojavan.com/mp3s/mp3/Shadmehr-Aghili-Avaz-Nemishi')
# Output :
# https://host2.rj-mw1.com/media/mp3/Shadmehr-Aghili-Avaz-Nemishi.mp3
Shanti