Aria2: Use Cookie STRING for each single file

Created on 28 Jan 2016  路  3Comments  路  Source: aria2/aria2

How can I use cookie string (Not file) for a single file download?

For example something like this:

aria2c --cookie='session=3f543ac31fc092bd' http://example.com/1.zip

question

Most helpful comment

@sky93
You could use header for this purpose:
aria2c --header="Cookie:session=3f543ac31fc092bd" http://example.com/1.zip

All 3 comments

@sky93
You could use header for this purpose:
aria2c --header="Cookie:session=3f543ac31fc092bd" http://example.com/1.zip

I think it would be nicer to have an option for it. Instead of manually crafting the header.

First You are missing a single-space character after Cookie:, it's very important.
aria2c --header="Cookie: session=3f543ac31fc092bd" http://example.com/1.zip

Also, a key (cookie name) and value should be safely-escaped before putting it into a cookie header (usually just the value is really required),
you can use JavaScript's escape encodeURIComponent("your text here") method (for example open a browser, then the developer-panel, then go to console and type there, or use nodejs from your command-line).

Finally, you can not use the value of document.cookie from the browser (for example) as is in aria2,
You only use the key=value part, and you need to split each key=value into its own --header="Cookie: ..." argument.

For example "_ga=GA1126152; _octo=GH15463; tz=New%20York",
will be: aria2c --header="Cookie: _ga=GA1126152" --header="Cookie: _octo=GH15463" --header="Cookie: tz=New%20York" http://example.com/1.zip.

Was this page helpful?
0 / 5 - 0 ratings