social media video downloader

פרמיום
על ידי ugoBoy | מְעוּדכָּן 20시간 전 | Social
פּוֹפּוּלָרִיוּת

9.8 / 10

חֶבִיוֹן

2,627ms

רמת שירות

100%

Health Check

90%

חזרה לכל הדיונים

Can't Download Youtube Audio.With Python code

Rapid account: Karshiboyevilyosbek

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

Rapid account: Ugo Boy
ugoBoy Commented 23일 전

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 23일 전

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 23일 전

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 한 달 전

can you show you’re code?

הצטרף לדיון - הוסף תגובה למטה:

התחבר / הירשם כדי לפרסם תגובות חדשות