Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Add standalone downloaders for POSIX and Windows. #52

Open
wants to merge 3 commits into
base: feature/hydrax-download
Choose a base branch
from

Conversation

KartikSoneji
Copy link
Contributor

Adds standalone downloaders for:

  • POSIX systems: only hard requirement is curl (obviously) (GNU sed and base64 needed for the HydraX script).
  • Windows: no additonal software required except a modern version of Windows 10.

Generates download scripts for direct links and HydraX links.
Also can generate a generic version of referrer links, but it is not currently in use.

Closes #35

Notes

  • If the curl script is interrupted, it can simply be restarted, and the download will continue from where it stopped.
    Unfortunately, I could not find a way to do this for the bat script.
  • The curl (not HydraX) script can easily be parallelize with GNU parallel.

@KartikSoneji
Copy link
Contributor Author

@thorio
I wasn't able to test all edge cases, so can you please go through it once?
Do let me know if I should change anything.

@shinji257
Copy link
Contributor

curl has it's own --referer option vs using the -H header option to add the header manually.

@KartikSoneji
Copy link
Contributor Author

@shinji257 Thanks for letting me know, I will make the changes.

@Thanhcaro
Copy link

Bro, is there tool for Windows can embed hydrax.com link? I need to download some hydrax link.

@KartikSoneji
Copy link
Contributor Author

Save this script as downloadHydraXVideo .bat

<# ::
@setlocal & copy "%~f0" "%TEMP%%~0n.ps1" >NUL && powershell -NoProfile -ExecutionPolicy Bypass -File "%TEMP%%~0n.ps1" %*
@set "ec=%ERRORLEVEL%" & del "%TEMP%%~0n.ps1"
@exit /b %ec%
#>

# downloadHydraXVideo <slug> <output file> [hd|sd]
function downloadHydraXVideo($1, $2, $3){
	$progressPreference = "silentlyContinue";
	
	$response = Invoke-WebRequest "https://ping.iamcdn.net/" `
		-UseBasicParsing `
		-Method POST `
		-Body @{slug = "$1"};
	
	
	$urlBase64 = (ConvertFrom-Json $response.Content).url;
	
    $url = [System.Text.Encoding]::UTF8.GetString(
			[System.Convert]::FromBase64String(
				$urlBase64.Chars($urlBase64.Length - 1) + $urlBase64.Substring(0, $urlBase64.Length - 1)
			)
		);
	
	if("$3" -ne "sd"){
		$url = "www." + $url;
	}
	
	Invoke-WebRequest "https://$url" `
		-UseBasicParsing `
		-Headers @{Referer = "https://playhydrax.com/?v=$1"} `
		-OutFile "$2";
	
	$progressPreference = "Continue";
}

downloadHydraXVideo $args[0] $args[1] $args[2];

Usage:

downloadHydraXVideo <slug> <output file> [hd|sd]

example
downloadHydraXVideo "GDUc-uLQN" "video.mp4" hd

@inoobbe
Copy link

inoobbe commented Oct 20, 2020

hello i m new to github . i just recently saw your post here
you write some code for how to download from hydrax .
actually i don't understand how to use it . can you help me please .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants