Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

download from 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
          
Comment

PREVIOUS NEXT
Code Example
Python :: erreur install pyaudio 
Python :: sdsdsdsdsddsdddsdsdsdsdsdsdsdsdsdsdsdsdsdssdsdsdsdsdsdsdssssssddsdssdssssdsdsdsdsdsdsdsdsdsdsdsdsdsdssdssdsdsdsdsdsdsdsdsdsdsdssd 
Python :: replace the jinja template value inside the dictionary python 
Python :: qlineedit autocomplete python 
Python :: how to display speechmarks in python string 
Python :: payizone 
Python :: python pandas reading pickelt 
Python :: discord.py ping command 
Python :: python format float as currency 
Python :: dataframe plot distribution of dates 
Python :: python selenium geolocation 
Python :: python tkinter text widget 
Python :: how to activate virtual environment in python 
Python :: python -m http 
Python :: binning dat adataframe 
Python :: get package share vs FindPackageShare 
Python :: pandas concat series into dataframe 
Python :: tqdm remove progress bar when done 
Python :: csv python write 
Python :: python run exe with arguments 
Python :: how to print 69 in python 
Python :: dataframe unique values in each column 
Python :: pandas select row by index 
Python :: how to get the index of a value in pandas dataframe 
Python :: Make solutions faster in python 
Python :: make each element in a list occur once python 
Python :: epoch to datetime utc python 
Python :: np array describe 
Python :: python code to wait 
Python :: pil image from numpy 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =