Last active
January 11, 2019 09:07
-
-
Save pansapiens/787e3d9c4d3159eb97e6 to your computer and use it in GitHub Desktop.
[DEPRECATED] Convert a list of CloudStor (& Owncloud?) shared file page links into direct download links.
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
#!/usr/bin/env python | |
""" | |
Takes a list of CloudStor download page links and turns them | |
into direct download links, suitable for use with wget -i or | |
aria2 -i. | |
$ convert_cloudstor_links.py page_links.txt >direct_links.txt | |
$ wget --content-disposition -c -i direct_links.txt | |
""" | |
import sys | |
from urlparse import urlparse, parse_qs | |
CLOUDSTOR_HOST = 'cloudstor.aarnet.edu.au' | |
links_filename = sys.argv[1] | |
with open(links_filename, 'r') as fh: | |
for l in fh: | |
link = l.strip() | |
if link[0] == '#': | |
continue | |
parts = urlparse(link) | |
uuid = parse_qs(parts.query)['vid'][0] | |
direct_url = 'https://%s/sender/download.php?vid=%s' % (CLOUDSTOR_HOST, | |
uuid) | |
print direct_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment