Created
November 21, 2022 15:42
-
-
Save rcastellotti/7d9ef631c4cff689b89ed07982513416 to your computer and use it in GitHub Desktop.
A simple rayplay.it python downloader with no external dependencies
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
from urllib.request import urlopen | |
import subprocess | |
import json | |
import argparse | |
def download(url): | |
with urlopen(url.replace(".html", ".json")) as response: | |
body = response.read() | |
payload = json.loads(body) | |
print(f"[rpdl]: downloading {payload['name']}") | |
subprocess.run( | |
[ | |
"ffmpeg", | |
"-i", | |
payload["video"]["content_url"], | |
f"./{payload['name'].replace('/','-')}.mp4", | |
] | |
) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser( | |
prog="rpdl", description="download raiplay.it videos" | |
) | |
parser.add_argument("url", help="URL of the content to download") | |
args = parser.parse_args() | |
download(args.url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment