sebbu

imgur export

Aug 26th, 2025
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.31 KB | None | 0 0
  1. #!/bin/bash
  2. # https://imgur.com/account/settings/apps
  3. token=`cat imgur_token.txt`
  4. num_per_page=50
  5. echo me
  6. curl -H "Authorization: Bearer $token" 'https://api.imgur.com/3/account/me' -o imgur_account_me.json
  7. echo images
  8. id=0
  9. while true
  10. do
  11.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/account/me/images/${id}" -o imgur_account_images_${id}.json
  12.         num=`cat imgur_account_images_${id}.json | jq -r '.data|length'`
  13.         ((id++))
  14.         [[ "$num" -lt "$num_per_page" ]] && break
  15. done
  16. echo 'favorites & submissions'
  17. curl -H "Authorization: Bearer $token" 'https://api.imgur.com/3/account/me/gallery_favorites' -o imgur_account_gallery_favorites.json
  18. curl -H "Authorization: Bearer $token" 'https://api.imgur.com/3/account/me/favorites' -o imgur_account_favorites.json
  19. curl -H "Authorization: Bearer $token" 'https://api.imgur.com/3/account/me/submissions' -o imgur_account_submissions.json
  20. echo albums
  21. id=0
  22. while true
  23. do
  24.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/account/me/albums/${id}" -o imgur_account_albums_${id}.json
  25.         num=`cat imgur_account_albums_${id}.json | jq -r '.data|length'`
  26.         ((id++))
  27.         [[ "$num" -lt "$num_per_page" ]] && break
  28. done
  29. echo albums ids
  30. id=0
  31. while true
  32. do
  33.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/account/me/albums/ids/${id}" -o imgur_account_albums_ids_${id}.json
  34.         num=`cat imgur_account_albums_ids_${id}.json | jq -r '.data|length'`
  35.         ((id++))
  36.         [[ "$num" -lt "$num_per_page" ]] && break
  37. done
  38. echo done
  39.  
  40. ids=`cat imgur_account_albums_ids_*.json | jq -r '.data[]'|dos2unix`
  41. for id in $ids
  42. do
  43.         echo $id
  44.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/account/sebbu/album/${id}" -o "imgur_account_album_${id}.json"
  45.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/album/${id}" -o "imgur_album_${id}.json"
  46.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/album/${id}/images" -o "imgur_album_${id}_images.json"
  47.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/gallery/album/${id}" -o "imgur_gallery_album_${id}.json"
  48.         curl -H "Authorization: Bearer $token" "https://api.imgur.com/3/gallery/image/${id}" -o "imgur_gallery_image_${id}.json"
  49.         #read
  50. done
Advertisement
Add Comment
Please, Sign In to add comment