social media video downloader

FREEMIUM
Por ugoBoy | Actualizada 2 giorni fa | Social
Popularidad

9.8 / 10

Latencia

2,951ms

Nivel de servicio

100%

Health Check

100%

Volver a todas las conversaciones

Can't Download Youtube Audio.With Python code

Rapid account: Karshiboyevilyosbek
karshiboyevilyosbek
16 giorni fa

API Is good but i can’t download audio with python code.Who can help me download this

Rapid account: Ugo Boy
ugoBoy Commented 11 giorni fa

The url doesn’t return a json, so you shouldn’t be parsing it as json at json_data = json.loads(data)

Rapid account: Karshiboyevilyosbek
karshiboyevilyosbek Commented 11 giorni fa

Here is my code.This code can’t give me audio.But I can download videos with this code.

Do you have solution in Python ???

Rapid account: Karshiboyevilyosbek
karshiboyevilyosbek Commented 11 giorni fa

async def save_audio(url):
chunk_size = 20 * 2 ** 20 # 20 MB
file_name = f"media/{shortuuid.uuid()}.mp3" # Save as mp3
with open(file_name, ‘wb’) as f:
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
data = await response.read()
json_data = json.loads(data)
audio_url = json_data.get(‘url’)
if audio_url:
async with session.get(audio_url) as audio_response:
while True:
chunk = await audio_response.content.read(chunk_size)
if not chunk:
break
f.write(chunk)
return file_name

Rapid account: Ugo Boy
ugoBoy Commented 16 giorni fa

can you show you’re code?

Únase a la conversación, añada un comentario a continuación:

Inicie sesió/Regístrese para publicar nuevos comentarios