Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jq + wget shell one-liner #35

Open
fluffy-critter opened this issue Sep 25, 2024 · 9 comments
Open

jq + wget shell one-liner #35

fluffy-critter opened this issue Sep 25, 2024 · 9 comments

Comments

@fluffy-critter
Copy link

curl https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s | jq '.data | .[] | select(.dhd) | .dhd' | xargs wget
@lilysoftpaws
Copy link

jq <3

@parkerlreed
Copy link

If you want you can have that go to a file and pass it in to wget -i so it will reuse the same connection as to not constantly disconnect and reconnect to the server.

@vs4vijay
Copy link

File is saved with wrong extension -AdamM~Pixelized~Key3.jpeg@expires=1728508444399&fm=jpg&s=23cac714f045d42bd940bb17c58a2e0f%0D

@fluffy-critter
Copy link
Author

File is saved with wrong extension -AdamM~Pixelized~Key3.jpeg@expires=1728508444399&fm=jpg&s=23cac714f045d42bd940bb17c58a2e0f%0D

Yeah there's probably some obscure wget option to make that work better, I've just been doing something like

for i in *@* ; do mv "$i" "$(echo $i | cut -f1 -d@)"

but the -d parameter varies by operating system (like on macOS and Linux it's ?).

@parkerlreed
Copy link

parkerlreed commented Sep 29, 2024

curl -OJ automatically saves it as the content disposition filename, which strips the extra chars.

wget -qO- https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s | jq -r '.data[] | select(.dhd) | .dhd' | while read line; do curl -OJ $line; done

@fluffy-critter
Copy link
Author

curl -OJ automatically saves it as the content disposition filename, which strips the extra chars.

wget -qO- https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s | jq -r '.data[] | select(.dhd) | .dhd' | while read line; do curl -OJ $line; done

Well then in that case we should go full circle and make it a curl oneliner:

curl https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s | jq -r '.data[] | select(.dhd) | .dhd' | while read f ; do curl -OJ $f ; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@vs4vijay @fluffy-critter @parkerlreed @lilysoftpaws and others