wolfv6/rclone_jobber

Add useragent string?

Closed this issue · 4 comments

Hi, in lights of the recent Google Issue (forum) (github issue), I'm trying to add --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36", but I can't get it to work because of the spaces and ( ).

I've temporarily solved it by just using a random string, but i would prefer using an actual user agent string from Chrome.

Any suggestion on how to add that?

If a string contains a space, then you must use extra quotes.

For Linux / OSX:
"'word word'"

For Windows:
'"word word"'

Details at https://rclone.org/docs/#quoting-and-the-shell.

Please tell me if that works.

It's not an issue if you just start rclone from the command line, the problem occurs when you pass it as a variable in the script.

options="--config ${rclone_jobber}/rclone.conf --filter-from ${rclone_jobber}/filter_rules --transfers 8 --checkers 4 --drive-chunk-size 256M --modify-window=1s --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36""

Rclone complains about too many passed settings (it splits up everything between spaces into wrong inputs)

So the issue is how to set a complex (as in spaces and ()/) user-agent as a part of a variable.

Try the quotes like this,

For Linux / OSX:
options="--config ... --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'"

For Windows:
options='--config ... --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"'

If that doesn't work, I don't know what the solution is.

Nope, does not work. I feel like I've tried every combination under the sun of single and double quotes. I've read somewhere that using an array instead of variable might work, but I did not figure it out (and have not had the time to dig deeper into it).

rclone sync /datapool gdrive-crypt:/last_snapshot --backup-dir=gdrive-crypt:/archive/2019/2019-05-16_23:19:23 --log-file=/datapool/rclone/log/rclone_jobber.log --log-level=INFO --config /datapool/rclone/rclone.conf --filter-from /datapool/rclone/filter_rules --transfers 8 --checkers 4 --drive-chunk-size 256M --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
ERROR: rcj-server.sh failed.  rclone exit_code=1

This is from the log file:

2019/05/16 23:27:18 DEBUG : rclone: Version "v1.47.0" starting with parameters ["rclone" "sync" "/datapool" "gdrive-crypt:/last_snapshot" "--backup-dir=gdrive-crypt:/archive/2019/2019-05-16_23:26:39" "--log-file=/datapool/rclone/log/rclone_jobber.log" "--log-level=DEBUG" "--config" "/datapool/rclone/rclone.conf" "--filter-from" "/datapool/rclone/filter_rules" "--transfers" "8" "--checkers" "4" "--drive-chunk-size" "256M" "--user-agent" "'Mozilla/5.0" "(Windows" "NT" "10.0;" "Win64;" "x64)" "AppleWebKit/537.36" "(KHTML," "like" "Gecko)" "Chrome/70.0.3538.77" "Safari/537.36'"]
Usage:
  rclone sync source:path dest:path [flags]

Flags:
      --create-empty-src-dirs   Create empty source dirs on destination after sync
  -h, --help                    help for sync

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
Command sync needs 2 arguments maximum: you provided 13 non flag arguments: ["/datapool" "gdrive-crypt:/last_snapshot" "(Windows" "NT" "10.0;" "Win64;" "x64)" "AppleWebKit/537.36" "(KHTML," "like" "Gecko)" "Chrome/70.0.3538.77" "Safari/537.36'"]
2019-05-16_23:27:19 ERROR: rcj-server.sh failed.  rclone exit_code=1

It works with just a random continuous string as the user-agent, since it don't need to parse anything.

EDIT: According to the thread over at rclone forums it looks like the issue could be gone. But I guess it's a good thing to solve anyways.