superalex / py-wetransfer Goto Github PK
View Code? Open in Web Editor NEWPython script for downloading wetransfer files (https://www.wetransfer.com/) in command line mode
Python script for downloading wetransfer files (https://www.wetransfer.com/) in command line mode
Hello
I have an issue since today while trying to download.
Downloading https://www.wetransfer.com/api/v1/transfers/88d55358d83fdda2aa4ff2ff6c0cdb4220160106184103/download?recipient_id=f1dccfc494c72d5f42e3ace7bc2700a520160106184103&security_hash=09e850&password=&ie=false...
Traceback (most recent call last):
File "wetransfer.py", line 109, in
main(sys.argv[1:])
File "wetransfer.py", line 101, in main
download(file_id, recipient_id, security_hash)
File "wetransfer.py", line 26, in download
content_info_string = parse_qs(urlparse(download_data['direct_link']).query)['response-content-disposition'][0]
KeyError: 'response-content-disposition'
Any idea ?
Thank you
Hello,
you need to modify the script to use TLS instead of SSLv3
I got this error:
Traceback (most recent call last):
File "wetransfer.py", line 127, in
main(sys.argv[1:])
File "wetransfer.py", line 119, in main
download(file_id, recipient_id, security_hash)
File "wetransfer.py", line 34, in download
r = requests.get(download_data['direct_link'], stream=True)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 383, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 486, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 385, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Cloud you check for arguments here?
https://github.com/superalex/py-wetransfer/blob/master/wetransfer.py#L92
./wetransfer.py
Traceback (most recent call last):
File "./wetransfer.py", line 108, in <module>
main(sys.argv[1:])
File "./wetransfer.py", line 92, in main
if argv[0].find('http') == 0:
IndexError: list index out of range
Request to https://www.wetransfer.com/api/v1/transfers/ return:
{u'error': u'No longer supported. Please note that scripting against our private API is against our TOS.'}
Downloading https://www.wetransfer.com/api/v1/transfers/033820e7d0a90af651dbbfb12263644120160202151021/download?recipient_id=&security_hash=06753a&password=&ie=false...
Traceback (most recent call last):
File "wetransfer.py", line 127, in
main(sys.argv[1:])
File "wetransfer.py", line 119, in main
download(file_id, recipient_id, security_hash)
File "wetransfer.py", line 34, in download
r = requests.get(download_data['direct_link'], stream=True)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 55, in get
return request('get', url, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 455, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 558, in send
r = adapter.send(request, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 385, in send
raise SSLError(e)
my version of python is 2.7.6
pip 8.0.2
very thank!!
Hi,
I had a problem with the direct_link. The script couldn't find the filename.
Solved it by changing a piece of code to:
if 'direct_link' in download_data:
direct_link_path = urlparse(download_data['direct_link']).path
direct_link_path = direct_link_path.split('/')
file_name = direct_link_path[-1]
r = requests.get(download_data['direct_link'], stream=True)
else:
Using:
Python 2.7.11
OS X 10.10.5
Hello, I'm trying to use this script to download WeTransfer videos in my Python script, but because there are no open-source licenses I cannot include the script inside my project. Can an open-source license be added? Thanks!
I tried it on Ubuntu and CentOS
The link: https://www.wetransfer.com/downloads/b9f2b36a1dc88de05b85c662d7a70d6b20140205144313/a74c378d223272d3a8fe6c77675e1df720140205144313/1deec1
$ python wetransfer.py -u [snip]
Downloading [snip]
Traceback (most recent call last):
File "wetransfer.py", line 127, in <module>
main(sys.argv[1:])
File "wetransfer.py", line 119, in main
download(file_id, recipient_id, security_hash)
File "wetransfer.py", line 36, in download
file_name = download_data['fields']['filename']
KeyError: 'fields'
Nowdays WT uses short URL-s like http://we.tl/pu9k8mcI7j
Please consider supporting it.
... so I removed it on lines 28 & 31 :)
r = requests.get(download_data['direct_link'])
r = requests.post(download_data['formdata']['action'], data=download_data["fields"])
I cannot download https://wingedcloud.wetransfer.com/downloads/61997c1379509ff9d2f630a8ec5d5ab420171003121859/085abf I get a error that the csrf_token is invalid.
Please check everything seems to be fine for me.
Could you chmod +x wetransfer.py
?
I am not a python expert so writing the changes in kind of hard.
The basic idea is that the links can sometimes be file_id/security_hash, note the missing recipient_id.
It wold be nice to have an IF check if security_hash is blank, and if so use the value from recipient_id, and blank the recipient_id.
Sample link,
For this type of link, the only way to get-it, is to do a first request, and then disassemble the redirect.
And from then apply current logic.
Responds with a 404 in download
function.
If someone is wondering why weTransfer is nog working anymore since this weekend (2017-07-15). It is because weTransfer changed some things. Normally you would get the json object with directlink by making an URL like this.
https://wetransfer.com/api/ui/transfers/XXXXXXXXXX/ZZZZZZ/download?recipient_id=YYYYYYYYYY
But now you have to do it like this:
https://wetransfer.com/api/ui/transfers/XXXXXXXXXX/ZZZZZZ/download as a POST request. In the same request you need to upload the recipient id wrapped in a json object like this.
{"recipient_id":"<recipient_id>"}
Just trying to download we transfer, it's looks sucessfull:
$python py-wetransfer/wetransfer.py https://www.wetransfer.com/downloads/xxxxx
Downloading https://www.wetransfer.com/api/v1/transfers/xxxx/download?recipient_id=xxx&security_hash=xxx&password=&ie=false...
100% 689/689
Finished! FA%2009.psd
But the content of file is:
$cat FA%2009.psd
<TITLE>ERROR: The request could not be satisfied</TITLE>This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests.
Generated by cloudfront (CloudFront) Request ID: PqFHOAJxOeySmYQuXFgCf0ESFQN2-VZDn7qe_QAVQ3tMOfxknDewOw==
would be amazing to get a cli option to upload :)
Hi, when I try to download a WeTrasnfer URL (1.6GB of data) it starts downloading, but after a while it says: Killed:
chris@loki:~/py-wetransfer$ python wetransfer.py -u https://www.wetransfer.com/downloads/5c518bc17beda289ed82f21e26450d6520131228191355/4a779270fbd97a47fde53823f695821620131228191355/#part removed#
Downloading https://www.wetransfer.com/api/v1/transfers/5c518bc17beda289ed82f21e26450d6520131228191355/download?recipient_id=4a779270fbd97a47fde53823f695821620131228191355&security_hash=#part removed#&password=&ie=false...
Killed
Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.