[Python] Download Instagram reel audio only with Instaloader/Python or any way

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to download the audio in the following format https://www.instagram.com/reels/audio/1997779980583970/. Below code is returning "Fetching metadata failed". I am able to download the reels but not separate audio files.

    What shall I do?

    def get_reel_audio_data(audio_id):
    loader = instaloader.Instaloader()
    try:
    # Fetch the audio post using the audio ID
    audio_post = instaloader.Post.from_shortcode(loader.context, audio_id)
    audio_url = audio_post.video_url if audio_post.is_video else audio_post.url
    return audio_url, True
    except Exception as e:
    if settings.DEBUG:
    import traceback
    print(traceback.format_exc())
    capture_exception(e)
    return None, False

    Continue reading...

Compartilhe esta Página