Skip to content

download: support download of images #1486

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

acg5159
Copy link

@acg5159 acg5159 commented May 1, 2025

Find all elements of tag '' and return binary data as base64 encoded string

This is a proof of concept to reenable download images using flaresolverr. I was able to test this and it will return all images on a page.

curl -s  'http://localhost:8191/v1' -H 'Content-Type: application/json' --data-raw '{
    "cmd":"request.get",
    "url":"${URL}",
    "download":"img"
}'  \
| jq -r '.solution.download[] | [.filename,.encoded_data] | join(",")' \
| while IFS=, read name data; do
    echo "$data" | base64 -d > "$name";
done

added download field to request and response.
Request field only supports "img" right now, (maybe expand to support xpath?
Response field returns array of objects containing the following fields:

[
  {
    "url": "https://cdn.example.com/uploads/img.webp",      # direct link to image
    "filename": "img.webp",                                 # image filename (last part of path in url)
    "mime_type": "image/webp",                              # mimeType
    "encoded_data":  "......"                               # base 64 encoded data
  },
   ...
]

Find all elements of tag '<img>' and retrun binary data as base64 encoded string

Signed-off-by: acg5159 <acg5159@gmail.com>
@acg5159 acg5159 marked this pull request as ready for review July 15, 2025 00:59
@xinxin8816
Copy link

using requests.get to download even without cookies? not bypass the cloudflare :<

@acg5159
Copy link
Author

acg5159 commented Jul 24, 2025

minor edit i forgot to push, just change the get line to this:
response = requests.get(img_url, timeout=10, cookies=challenge_res.cookies)

99% of the time I did not need this fix.

@xinxin8816
Copy link

Not only that, lots of cloudflare webside using JA3/JA4 Fingerprint to checking bot unfortunately.

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

Successfully merging this pull request may close these issues.

2 participants