social media video downloader

FREEMIUM
Par ugoBoy | Mise à jour il y a 2 jours | Social
Popularité

9.8 / 10

Latence

2,537ms

Niveau de service

100%

Health Check

90%

Retour à toutes les discussions

Can't Download Youtube Audio.With Python code

Rapid account: Karshiboyevilyosbek
karshiboyevilyosbek
il y a un mois

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

Rapid account: Ugo Boy
ugoBoy Commented il y a 24 jours

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 il y a 25 jours

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 il y a 25 jours

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 il y a un mois

can you show you’re code?

Participez à la discussion - ajoutez un commentaire ci-dessous:

Connectez-vous / Inscrivez-vous pour publier de nouveaux commentaires