Last active
January 6, 2025 17:43
-
-
Save dougbenham/400ca9fc488126bf9065e9a6cc3657ad to your computer and use it in GitHub Desktop.
LeakedZone Scraper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Working as of January 5th, 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" | |
} | |
} | |
} | |
} | |
Write-Host -NoNewLine 'Press any key to continue...'; | |
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); |
doesn't work, Invoke-WebRequest error, could you please double check on your end?
I've provided cookie according to the instruction
doesn't work, Invoke-WebRequest error, could you please double check on your end? I've provided cookie according to the instruction
Its working. Just helped someone get it working yesterday as well. Cloudflare tokens only last like 10 to 20 minutes or something crazy so you have to keep retrieving new cookies. Make sure you hard-refresh the page in your browser (hopefully firefox) and pull the cookie header data and populate your script with it. Make sure you have the correct user-agent set as well.
You can add me on discord if you want more detailed help: edenwarrior
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download
Paste the code into a file called
LeakedZone.ps1
. DownloadN_m3u8DL-RE.exe
from https://github.com/nilaoda/N_m3u8DL-RE/releases/latest and put it next to the powershell script.Configuration
Edit the cookies, user-agent and names at the top of the script.
For names, it is the username of the creator on leakedzone. Go to the creator's page and look in the url to see the username, it won't contain any spaces.
For cookies, it is easiest to retrieve using Firefox with uBlock Origin extension to block LeakedZone's dev-tools detector. Here is an example of how to retrieve the Cookie & User-Agent headers:
You can use this uBlock Origin extension to prevent LeakedZone from detecting your dev-tools being open. Add this to your My Filters section of uBlock Origin:
leakedzone.com##^script:has-text(devtoolsDetector)
Keep in mind that Cloudflare tokens only last like 10 to 20 minutes or something crazy so you have to keep retrieving new cookies. If downloading a creator's content takes longer than 10 to 20 minutes, you'll have to close the script after it starts erroring, grab new cookie from firefox and then re-run the script. Duplicates won't be downloaded so don't worry about that.
Running
If you don't have Powershell 7, install it. Open Powershell 7 command prompt, navigate to the folder where you saved the file (by using
cd C:\blahblah\blah
). Type. LeakedZone.ps1
and it should run the script.