Skip to content

Instantly share code, notes, and snippets.

@dougbenham
Last active October 30, 2025 20:35
Show Gist options
  • Save dougbenham/400ca9fc488126bf9065e9a6cc3657ad to your computer and use it in GitHub Desktop.
Save dougbenham/400ca9fc488126bf9065e9a6cc3657ad to your computer and use it in GitHub Desktop.
LeakedZone Scraper
# Working as of July 22nd, 2025
# - You'll need N_m3u8DL-RE (grab it from https://github.com/nilaoda/N_m3u8DL-RE/releases/latest)
# - You'll need to edit the cookies (on line 10), the user agent (on line 12), and the names you want to download (on line 14).
# - See this comment for a picture on how to populate these values: https://gist.github.com/dougbenham/400ca9fc488126bf9065e9a6cc3657ad?permalink_comment_id=5114236#gistcomment-5114236
$env:PATH += ";."
$headers = @{
'Accept-Encoding' = 'gzip, deflate'
'Cookie' = 'cf_clearance=..; XSRF-TOKEN=..; leakedzone_session=.. AND MAYBE MORE, PULL ALL COOKIES FROM FIREFOX'
'X-Requested-With' = 'XMLHttpRequest'
'User-Agent' = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0'
}
$names = @('amouranth', 'mackzjoness')
$VideoDownloader = "N_m3u8DL-RE.exe"
If (-not (Test-Path -PathType Leaf $VideoDownloader)) {
Start-Process "https://github.com/nilaoda/N_m3u8DL-RE/releases/latest"
Exit
}
foreach ($Name in $names) {
$Url = "https://leakedzone.com/$Name"
New-Item -ItemType Directory -Force -Path ($Name + "\Photos\")
New-Item -ItemType Directory -Force -Path ($Name + "\Videos\")
$i = 1
While ($True) {
Write-Host "Querying $Name photos (page $i)..";
$x = Invoke-WebRequest "$($Url)?page=$($i)&type=photos&order=0" -headers $headers
$i++
$A = ($x.content | ConvertFrom-Json)
if (-not $A) { break }
foreach ($item in $A) {
$photourl = "https://image-cdn.leakedzone.com/storage/" + $item.image
if (-not $photourl) { continue }
$filename = $Name + "\Photos\" + $item.slug + [System.IO.Path]::GetExtension(([uri]$photourl).Segments[-1])
if (-not (Test-Path $filename -PathType Leaf)) {
Invoke-WebRequest -Uri $photourl -Headers $headers -Outfile $filename
}
}
}
$i = 1
While ($True) {
Write-Host "Querying $Name videos (page $i)..";
$x = Invoke-WebRequest "$($Url)?page=$($i)&type=videos&order=0" -headers $headers
$i++
$A = ($x.content | ConvertFrom-Json)
if (-not $A) { break }
foreach ($item in $A) {
$videourl = $item.stream_url_play
$slug = $item.slug
if (-not $videourl) { continue }
$videourl = $videourl.Substring(16, $videourl.Length - 32)
$videourl = $videourl[-1.. - $videourl.Length] -join ''
$videourl = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($videourl))
If (-not (Test-Path -PathType Leaf "$Name\Videos\$slug.*")) {
. $VideoDownloader "$videourl" --save-dir "$Name\Videos" --save-name "$slug"
Start-Sleep 5
}
}
}
}
Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
@wHaykl
Copy link

wHaykl commented Jun 21, 2025

Thank you man, I had a headache after 1 hour trying to complete it, but everything works fine, (if your bad like me with these kind of stuff and you're getting errors, it's most of the time that you didn't close the cookies and useragent with the right symbol named single quote : ' and not the apostrophe) AND also can someone tell me what can I change so it only downloads the videos ?

@jkfousek
Copy link

Thank you man, I had a headache after 1 hour trying to complete it, but everything works fine, (if your bad like me with these kind of stuff and you're getting errors, it's most of the time that you didn't close the cookies and useragent with the right symbol named single quote : ' and not the apostrophe) AND also can someone tell me what can I change so it only downloads the videos ?

Remove line 24 and 27-44

@wHaykl
Copy link

wHaykl commented Jun 30, 2025

Thank you man, I had a headache after 1 hour trying to complete it, but everything works fine, (if your bad like me with these kind of stuff and you're getting errors, it's most of the time that you didn't close the cookies and useragent with the right symbol named single quote : ' and not the apostrophe) AND also can someone tell me what can I change so it only downloads the videos ?

Remove line 24 and 27-44

ty

@try123654
Copy link

It says ffmpeg not found. So it can't get videos

I have same question, and can't solve by download ffmpeg on provide website.

@dougbenham
Copy link
Author

It says ffmpeg not found. So it can't get videos

I have same question, and can't solve by download ffmpeg on provide website.

image

@try123654
Copy link

Thanks for the reply, I lost the key step yesterday, It's work now.

@clemep8
Copy link

clemep8 commented Jul 22, 2025

was working for a while, but seems to get 403 Forbidden on the video URLs now:

[generic] Extracting URL: https://leakedzone.com/m3u8/20319867.m3u8?time=1753195648&sig=5e00e6924a9df146d1cc51bbed68ee9a39d...ig2=5o2NMhjtjtFSRrhV
[generic] 20319867: Downloading webpage
[generic] 20319867: Downloading m3u8 information
ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)

@jkfousek
Copy link

was working for a while, but seems to get 403 Forbidden on the video URLs now:

[generic] Extracting URL: https://leakedzone.com/m3u8/20319867.m3u8?time=1753195648&sig=5e00e6924a9df146d1cc51bbed68ee9a39d...ig2=5o2NMhjtjtFSRrhV [generic] 20319867: Downloading webpage [generic] 20319867: Downloading m3u8 information ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)

Your ip or cookies may have been blocked. Have you tried switching vpn server / switch your cookies. Also make to use private browsing so u can grab Th CF_Clearance cookie. I'm at work right now so I can help u out more later

@jkfousek
Copy link

It says ffmpeg not found. So it can't get videos

I have same question, and can't solve by download ffmpeg on provide website.

image

Winget install ffmpeg / refresh terminal and run your code again

@clemep8
Copy link

clemep8 commented Jul 22, 2025

was working for a while, but seems to get 403 Forbidden on the video URLs now:
[generic] Extracting URL: https://leakedzone.com/m3u8/20319867.m3u8?time=1753195648&sig=5e00e6924a9df146d1cc51bbed68ee9a39d...ig2=5o2NMhjtjtFSRrhV [generic] 20319867: Downloading webpage [generic] 20319867: Downloading m3u8 information ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)

Your ip or cookies may have been blocked. Have you tried switching vpn server / switch your cookies. Also make to use private browsing so u can grab Th CF_Clearance cookie. I'm at work right now so I can help u out more later

I don't think IP is blocked, it still works in the browser. I copied all the cookies (cf_clearance, leakedzone_session, XSRF-TOKEN) as I had been doing previously, but it still doesn't work (for videos). I was able to DL photos yesterday, and that worked fine.

@dougbenham
Copy link
Author

dougbenham commented Jul 22, 2025

was working for a while, but seems to get 403 Forbidden on the video URLs now:

[generic] Extracting URL: https://leakedzone.com/m3u8/20319867.m3u8?time=1753195648&sig=5e00e6924a9df146d1cc51bbed68ee9a39d...ig2=5o2NMhjtjtFSRrhV [generic] 20319867: Downloading webpage [generic] 20319867: Downloading m3u8 information ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)

This looks like yt-dlp output. yt-dlp is not used to download the videos from LeakedZone, N_m3u8DL-RE is used. Please review the script again and update if necessary.

@clemep8
Copy link

clemep8 commented Jul 22, 2025

was working for a while, but seems to get 403 Forbidden on the video URLs now:
[generic] Extracting URL: https://leakedzone.com/m3u8/20319867.m3u8?time=1753195648&sig=5e00e6924a9df146d1cc51bbed68ee9a39d...ig2=5o2NMhjtjtFSRrhV [generic] 20319867: Downloading webpage [generic] 20319867: Downloading m3u8 information ERROR: [generic] Failed to download m3u8 information: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)

This looks like yt-dlp output. yt-dlp is not used to download the videos from LeakedZone, N_m3u8DL-RE is used. Please review the script again and update if necessary.

Yes, I already had yt-dlp, so just used that, which was working up until about a week ago, but I just DLed N_m3u8DL-RE and it's working now. Thanks.

@dougbenham
Copy link
Author

Great to hear.

I updated the script with a 5 second delay after each video (because otherwise you hit some rate-limiting and then you have to rerun the script until all the downloads complete successfully).

@EarthedVein-Junk
Copy link

Works! Thank you.

@JHanToGa
Copy link

Hi, i don't know how all of this work. I try but don't understand a thing on how i can download all pics and videos from Leakedzone. Can i have some help please ? I download the Github Desktop for info. Thanks.

@Jinndemono
Copy link

I tried for hours with cookies and always get this error
Cannot bind argument to parameter 'InputObject' because it is null. any advice :(

@GajosTheFajos
Copy link

Also getting the 'InputObject' null problem. Probably the webpage has changed and the script not been updated accordingly..

Invoke-WebRequest: D:\LeakedZone.ps1:30
Line |
30 | … $x = Invoke-WebRequest "$($Url)?page=$($i)&type=photos&order=0 …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to read data from the transport connection: An existing connection was forcibly closed by the remote
| host..
ConvertFrom-Json: D:\LeakedZone.ps1:32
Line |
32 | $A = ($x.content | ConvertFrom-Json)
| ~~~~~~~~~~~~~~~~
| Cannot bind argument to parameter 'InputObject' because it is null.

@jkfousek
Copy link

Also getting the 'InputObject' null problem. Probably the webpage has changed and the script not been updated accordingly..

Invoke-WebRequest: D:\LeakedZone.ps1:30 Line | 30 | … x = I n v o k e − W e b R e q u e s t " ( U r l ) ? p a g e = ($i)&type=photos&order=0 … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Unable to read data from the transport connection: An existing connection was forcibly closed by the remote | host.. ConvertFrom-Json: D:\LeakedZone.ps1:32 Line | 32 | $A = ($x.content | ConvertFrom-Json) | ~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'InputObject' because it is null.

works for me just slower now

@jkfousek
Copy link

Also getting the 'InputObject' null problem. Probably the webpage has changed and the script not been updated accordingly..

Invoke-WebRequest: D:\LeakedZone.ps1:30 Line | 30 | … x = I n v o k e − W e b R e q u e s t " ( U r l ) ? p a g e = ($i)&type=photos&order=0 … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Unable to read data from the transport connection: An existing connection was forcibly closed by the remote | host.. ConvertFrom-Json: D:\LeakedZone.ps1:32 Line | 32 | $A = ($x.content | ConvertFrom-Json) | ~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'InputObject' because it is null.

works for me

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