Skip to content

Instantly share code, notes, and snippets.

@mmpx12
Created August 21, 2023 04:20
Show Gist options
  • Save mmpx12/9364f8f9665efade3661a4cf07ae39df to your computer and use it in GitHub Desktop.
Save mmpx12/9364f8f9665efade3661a4cf07ae39df to your computer and use it in GitHub Desktop.
leakedzone downloader
#!/usr/bin/bash
function GetVideos(){
username="$1"
page=0
while true; do
a=($(curl -s "https://leakedzone.com/$username?page=$page&type=videos&order=0" \
-H 'X-Requested-With: XMLHttpRequest' | \
jq -r '.[]|(.slug + "/" + .stream_url_play)'))
n=0
[[ "${#a[@]}" -eq 0 ]] && return
for i in "${a[@]}"; do
slug="$(cut -d "/" -f1 <<< "$i")"
path="$(cut -d "/" -f2 <<< "$i")"
url="$(echo -n "$path" | cut -c17- | rev | cut -c17- | base64 -d)"
yt-dlp "$url" -o "videos/$slug.%(ext)s" > /dev/null
echo -ne "\rpage: $page, video: $n/${#a[@]} "
((n++))
done
((page++))
done
}
function GetPhotos(){
username="$1"
page=0
while true; do
a=($(curl -s "https://leakedzone.com/$username?page=$page&type=photos&order=0" \
-H 'X-Requested-With: XMLHttpRequest' | jq -r '.[].image'))
[[ "${#a[@]}" -eq 0 ]] && return
n=0
for i in "${a[@]}"; do
wget -qP photos "https://leakedzone.com/storage/$i"
echo -ne "\rpage: $page, image: $n/${#a[@]} "
((n++))
done
((page++))
done
}
GetPhotos "$1"
GetVideos "$1"
@FransUrbo
Copy link

I'm having problem with the video downloader..

$ leakedzone.sh jennachew
DEBUG: slug='47cb87c22f3e7c9d0112c50acff3690f'
DEBUG: path='VUsVictqET2RCSM8CZHcMl2TEV0cl1WavJTTE1jMnl2cmY2MmFGMjRWOjZzM5QzY1MjZwYDOyMWYldDMyIWMkJWZwYzY1ImNwQTOyQWZxQzM1IWYihDM3UTZiJmNjNWMlRWPnl2cmUDNxEjM3MTN3ETPl1Wa09DO1NTbugTN1YzN3QzL4U3Mt9SbvNmLl52b6RWZrFWZs9yL6MHc0RHai6hJMUL7Ex5SkdnO'
DEBUG: url='https://leakedzone.com/m3u8/4776558.m3u8?time=1753721145&sig=de1cc6bbe5708bab5341ed29406b5c60ebd1b207eac2860f35c4936c9dc0af3f&sig2=DM2oimesEDOiLpvB'
ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)
$

Note, I've disabled the photo downloader, already done that. Works fine.. I also added some debugging, to see what it was doing.

Technically, I guess the error comes from yt-dlp, but maybe it's not sent the correct/full URL?

$ yt-dlp 'https://leakedzone.com/m3u8/4776558.m3u8?time=1753721145&sig=de1cc6bbe5708bab5341ed29406b5c60ebd1b207eac2860f35c4936c9dc0af3f&sig2=DM2oimesEDOiLpvB'
[generic] Extracting URL: https://leakedzone.com/m3u8/4776558.m3u8?time=1753721145&sig=de1cc6bbe5708bab5341ed29406b5c60ebd1...ig2=DM2oimesEDOiLpvB
[generic] 4776558: Downloading webpage
ERROR: [generic] Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)
$

Posting that URL in Chrome, it did download something. The file 4776558.m3u8 it downloaded contains:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:5.005000,
https://cdn55.leakedzone.com/sda55/leak/1325/4776558/video0.ts?secure=QKX-BGs-7JBuo_SVBkMRCg==,1753721543
#EXTINF:4.796778,
https://cdn55.leakedzone.com/sda55/leak/1325/4776558/video1.ts?secure=G8JFcXBm-M-tq5ijsTCqCA==,1753721543
#EXT-X-ENDLIST

Sending either of those URLs do download the correct video. I'll report this to yt-dlp..

@FransUrbo
Copy link

Ok, I realised that yt-dlp won't add support for LeakedZone because they don't support copyrighted material..

Instead, I've modified the script to download all the individual parts in that file I get using curl. Then go through each of the links, download them (using yt-dlp, which still seems to work - although could probably use curl for that as well?), and then merge them together using ffmpeg.

Seems to be working just fine!

Sorry @john-peterson, but I don't have Firefox, and don't want to download and install that just for this :). Besides, your fork can't download videos either, so..

@mmpx12 if you want to update your "revision 1" with my version, go a head, and I'll remove my comments and my fork..

@mmpx12
Copy link
Author

mmpx12 commented Jul 28, 2025

@FransUrbo Every videos are now in m3u8 format?

@FransUrbo
Copy link

No idea actually.. As far as I can tell anyway. At least anything newer?

That was the only part of my changes that was a bit .. sketchy. The ffmpeg part. Don't know of a way to get the format of the finished file..
The actual videos downloaded is a .ts (whatever that is, file just say "data").

@FransUrbo
Copy link

I just stumbled across a user, where they've separated the URI and the path in the json.

In the ones we've been using so far, it looks like this:

    "slug": "80364414eaf2b05636b6b5656a618e69",
    "stream_url_play": "mcEwQsg0QCKvuv5ZVpXdTZzSlRGN5FFNNRWaX1jMnl2cmQDM4kzMiRjN1EWO0MmYjFzMyITYjZzNjBzMiNTZhVTMlJGOlVDNxgDZzUDOmNTMhNjMzE2NwM2NxUDZiVzMiJTPnl2cmAjMwUDN3MTN3ETPl1Wa09DO1NTbugjNzkjM3QzL4U3Mt9SbvNmLl52b6RWZrFWZs9yL6MHc0RHapfJuAvE3cIqOnBN7",

There, stream_url_play is URI and PATH combined. But the user I just tried on, there it looks like this:

    "slug": "eb05693a691592f53786b6cf96ff99a0",
    "stream_url_play": "1w5u6xI8O9t2EYRu==gbh1kbTd0QZNURkVUOxUTY9IzZpNnJ1MWM5YjY5M2YjFWYjV2NiZmZjVDO4AzYyMGMxMjYidDM5IWM2UDZzgDMjZTMyAjMkFGM4EzNxQWNihTMwYmNh1zZpNnJ5kTOzQzNzUzNx0TZtlGd/gTdz0mLxETO5cTNxEzL4U3Mt9SbvNmLl52b6RWZrFWZs9yL6MHc0RHatp77xrJcd97NPKE8",

Took a while to figure out what happened there, but fixed in my "revision 4".

There's a / in the stream_url_play new (?) format. So the whole string is <slug>/<stream_url_play> (hence the second slash, which is in the new stream_url_play string). We just look for that, and then do things differently.. It's not pretty, but.. :)

@FransUrbo
Copy link

FransUrbo commented Jul 28, 2025

Oh, also tried to remove the hard-coded .mp4, but then ffmpeg got nuts! Just copied the parts into the videos directory, without creating an actual concatenated video!

Using a .mp4 suffix seems to be working, I have no problem viewing it either with Preview or VLC on my (old) MacBook..

@goldenfreddynecro-boop
Copy link

@FransUrbo can you please explain to me how u got videos to download from leaked zone? I have been trying for a while now but it hasnt worked for me

@FransUrbo
Copy link

@goldenfreddynecro-boop you'll need my fork of the script - https://gist.github.com/FransUrbo/61033475c3409f8b2211c0d23daf8d90.

Basically, they're now streaming the videos in multiples. So you need to download all of them, then merge them into one. That's what my fork is doing. At least it worked a few weeks ago :).

@FransUrbo
Copy link

Oh, and they've also added a throttle on the stream, so if you try to download the parts to fast, they'll block you for a few minutes :( :(.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment