dropcreations / Manzana-Apple-Music-Downloader

A python program to download albums and songs with AAC codec in .m4a container format and music-videos up to 4K in AVC or HEVC codec in .mp4 format from Apple Music.
https://music.apple.com
GNU General Public License v3.0
182 stars 23 forks source link

KeyError: 0 #8

Closed tmxkwpn closed 9 months ago

tmxkwpn commented 11 months ago

installed all requirements, ran the command python manzana.py https://music.apple.com/us/music-video/taki-taki-feat-selena-gomez-ozuna-cardi-b/1438473545, added the media-user-token but when I select an ID I get this error :

    $$$$$$\$$$$\   $$$$$$\  $$$$$$$\  $$$$$$$$\ $$$$$$\  $$$$$$$\   $$$$$$\
    $$  _$$  _$$\  \____$$\ $$  __$$\ \____$$  |\____$$\ $$  __$$\  \____$$\
    $$ / $$ / $$ | $$$$$$$ |$$ |  $$ |  $$$$ _/ $$$$$$$ |$$ |  $$ | $$$$$$$ |
    $$ | $$ | $$ |$$  __$$ |$$ |  $$ | $$  _/  $$  __$$ |$$ |  $$ |$$  __$$ |
    $$ | $$ | $$ |\$$$$$$$ |$$ |  $$ |$$$$$$$$\\$$$$$$$ |$$ |  $$ |\$$$$$$$ |
    \__| \__| \__| \_______|\__|  \__|\________|\_______|\__|  \__| \_______|

                        ──── Apple Music Downloader ────

[13:19:26] [ManzanaCore] INFO: Checking access token found in cache... [13:19:26] [ManzanaCore] INFO: Checking media-user-token... [13:19:27] [ManzanaCore] INFO: Fetching api response... [13:19:27] [ManzanaCore] INFO: Using the previous response found in cache... [13:19:27] [ManzanaCore] INFO: Getting playback information... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:28] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:29] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:30] [ManzanaCore] INFO: Using the key found in cache... [13:19:31] [ManzanaCore] INFO: Getting video streams list...

    ┌────┬───────┬────────────┬────────────┬────────┬───────┐
    │ ID │ Codec │ Bitrate    │ Resolution │  FPS   │ Range │
    ├────┼───────┼────────────┼────────────┼────────┼───────┤
    │ 0  │ AVC   │ 2.22 Mb/s  │ 1252x468   │ 23.976 │  SDR  │
    │ 1  │ HEVC  │ 1.58 Mb/s  │ 1252x468   │ 23.976 │  SDR  │
    │ 2  │ AVC   │ 0.3 Mb/s   │ 588x220    │ 23.976 │  SDR  │
    │ 3  │ AVC   │ 0.4 Mb/s   │ 664x248    │ 23.976 │  SDR  │
    │ 4  │ AVC   │ 0.55 Mb/s  │ 744x278    │ 23.976 │  SDR  │
    │ 5  │ AVC   │ 0.8 Mb/s   │ 822x308    │ 23.976 │  SDR  │
    │ 6  │ AVC   │ 1.16 Mb/s  │ 860x322    │ 23.976 │  SDR  │
    │ 7  │ AVC   │ 1.56 Mb/s  │ 862x322    │ 23.976 │  SDR  │
    │ 8  │ AVC   │ 2.99 Mb/s  │ 1566x586   │ 23.976 │  SDR  │
    │ 9  │ AVC   │ 4.01 Mb/s  │ 1566x586   │ 23.976 │  SDR  │
    │ 10 │ AVC   │ 5.25 Mb/s  │ 1920x718   │ 23.976 │  SDR  │
    │ 11 │ AVC   │ 6.87 Mb/s  │ 1920x718   │ 23.976 │  SDR  │
    │ 12 │ AVC   │ 10.2 Mb/s  │ 1920x718   │ 23.976 │  SDR  │
    │ 13 │ HEVC  │ 0.29 Mb/s  │ 588x220    │ 23.976 │  SDR  │
    │ 14 │ HEVC  │ 0.44 Mb/s  │ 744x278    │ 23.976 │  SDR  │
    │ 15 │ HEVC  │ 0.62 Mb/s  │ 822x308    │ 23.976 │  SDR  │
    │ 16 │ HEVC  │ 0.87 Mb/s  │ 860x322    │ 23.976 │  SDR  │
    │ 17 │ HEVC  │ 1.15 Mb/s  │ 862x322    │ 23.976 │  SDR  │
    │ 18 │ HEVC  │ 2.26 Mb/s  │ 1566x586   │ 23.976 │  SDR  │
    │ 19 │ HEVC  │ 2.88 Mb/s  │ 1566x586   │ 23.976 │  SDR  │
    │ 20 │ HEVC  │ 4.04 Mb/s  │ 1920x718   │ 23.976 │  SDR  │
    │ 21 │ HEVC  │ 5.1 Mb/s   │ 1920x718   │ 23.976 │  SDR  │
    │ 22 │ HEVC  │ 7.19 Mb/s  │ 1920x718   │ 23.976 │  SDR  │
    │ 23 │ HEVC  │ 12.37 Mb/s │ 3832x1434  │ 23.976 │  SDR  │
    └────┴───────┴────────────┴────────────┴────────┴───────┘

     Enter ID: 8

┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐ │ C:\Manzana-Apple-Music-Downloader-main\manzana.py:64 in │ │ │ │ 61 if name == "main": │ │ 62 │ os.system('cls' if os.name == 'nt' else 'clear') │ │ 63 │ console.print(LOGO) │ │ > 64 │ main() │ │ │ │ C:\Manzana-Apple-Music-Downloader-main\manzana.py:59 in main │ │ │ │ 56 │ │ type=str │ │ 57 │ ) │ │ 58 │ args = parser.parse_args() │ │ > 59 │ arguments(args) │ │ 60 │ │ 61 if name == "main": │ │ 62 │ os.system('cls' if os.name == 'nt' else 'clear') │ │ │ │ C:\Manzana-Apple-Music-Downloader-main\handler.py:190 in arguments │ │ │ │ 187 │ │ │ ): │ │ 188 │ │ │ │ logger.warning(f'"{file}.mp4" is already exists!') │ │ 189 │ │ │ else: │ │ > 190 │ │ │ │ videoUrl, decryptKey = getVideos(content) │ │ 191 │ │ │ │ download( │ │ 192 │ │ │ │ │ videoUrl, │ │ 193 │ │ │ │ │ os.getcwd(), │ │ │ │ C:\Manzana-Apple-Music-Downloader-main\core\download\video.py:64 in getVideos │ │ │ │ 61 │ │ id = int(input("\n\t Enter ID: ")) │ │ 62 │ │ print() │ │ 63 │ │ │ │ > 64 │ │ if id in ids: return [getUrls(streamList[id].get("uri")), streamList[id].get(" │ │ 65 │ │ else: logger.error("ID not found in the list!", 1) │ │ 66 │ else: logger.error("No video streams available!", 1) │ │ │ │ C:\Manzana-Apple-Music-Downloader-main\core\download\video.py:21 in getUrls │ │ │ │ 18 │ │ json.dumps(data.data) │ │ 19 │ ) │ │ 20 │ │ │ > 21 │ initSegment = __data["segment_map"][0]["uri"] │ │ 22 │ urls = [baseUri + initSegment] │ │ 23 │ │ │ 24 │ for s in data["segments"]: │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ KeyError: 0

Also when trying to download an album, I get this :

    $$$$$$\$$$$\   $$$$$$\  $$$$$$$\  $$$$$$$$\ $$$$$$\  $$$$$$$\   $$$$$$\
    $$  _$$  _$$\  \____$$\ $$  __$$\ \____$$  |\____$$\ $$  __$$\  \____$$\
    $$ / $$ / $$ | $$$$$$$ |$$ |  $$ |  $$$$ _/ $$$$$$$ |$$ |  $$ | $$$$$$$ |
    $$ | $$ | $$ |$$  __$$ |$$ |  $$ | $$  _/  $$  __$$ |$$ |  $$ |$$  __$$ |
    $$ | $$ | $$ |\$$$$$$$ |$$ |  $$ |$$$$$$$$\\$$$$$$$ |$$ |  $$ |\$$$$$$$ |
    \__| \__| \__| \_______|\__|  \__|\________|\_______|\__|  \__| \_______|

                        ──── Apple Music Downloader ────

[13:21:21] [ManzanaCore] INFO: Checking access token found in cache... [13:21:21] [ManzanaCore] INFO: Checking media-user-token... [13:21:22] [ManzanaCore] INFO: Fetching api response... [13:21:22] [ManzanaCore] ERROR: None - None

dropcreations commented 11 months ago

@tmxkwpn Try updating m3u8.

pip install --upgrade m3u8
tmxkwpn commented 11 months ago

Thanks, it was just that.

Is there a way to auto select best format btw ?

dropcreations commented 11 months ago

@tmxkwpn Auto selection is not implemented yet! Will add it later!