iamleot / transferwee

Download/upload files via wetransfer.com
155 stars 38 forks source link

Downloads not working - Could not find any csrf-token in _prepare_session #40

Closed peterk closed 1 year ago

peterk commented 1 year ago

It seems like WeTransfer changed something in the past couple of days and download_url now raises ConnectionError('Could not prepare session').

_prepare_session reports "Could not find any csrf-token".

peterk commented 1 year ago

The problem seems to be that wetransfer.com no longer has a csrf token to be parsed at line 192 in _prepare_session

iamleot commented 1 year ago

Hello! Can you please share a possible way to reproduce it?

At least yesterday and last night all tests passed successfully (against current Git HEAD).

I've also rechecked via tests/check.sh now and I could not reproduce it.

peterk commented 1 year ago

I get the same error running the check script.

(base) ➜  tests git:(master) ./check.sh
Creating a test file...
Uploading the test file...
Checking that all files exists
Checking for no duplicate filenames
Preparing to upload
Could not find any csrf-token
Traceback (most recent call last):
  File "/transferwee_orig/transferwee/transferwee.py", line 566, in <module>
    print(upload(args.files, args.n, args.m, args.f, args.t))
  File "/transferwee_orig/transferwee/transferwee.py", line 485, in upload
    raise ConnectionError('Could not prepare session')
ConnectionError: Could not prepare session

Looking at the wetransfer.com website source I see no csrf element to parse.

Buuut...I am connecting from Sweden. Switching to VPN and connecting from the US the csrf token is there. Are they rolling out a new website by region?

iamleot commented 1 year ago

I have no idea, sorry! Everything that I know about wetransfer.com was reverse engineered!

That's interesting though! Unfortunately until I will not be able to reproduce I could probably not easily help.

peterk commented 1 year ago

Tested various methods and it seems that cookies are used instead of the csrf meta element in some cases. Continuing with the fetched session makes the check script work again.

iamleot commented 1 year ago

Fixed via #42.

Thanks!