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

Invalid image content when making request with use_stealth=True #89

Closed
Wixome opened this issue Apr 1, 2024 · 1 comment
Closed

Invalid image content when making request with use_stealth=True #89

Wixome opened this issue Apr 1, 2024 · 1 comment

Comments

@Wixome
Copy link

Wixome commented Apr 1, 2024

Hi!
When I make a request with use_stealth=True the content of the response is different from the same request without use_stealth.
Example of the first 20 characters of the content:

use_stealth=False
b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x02\x01\x00H\x00H\x00\x00'
use_stealth=True
b'\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x10JFIF\x00\x01'

Reproduction code:

from botasaurus import *

@request()
def without_stealth(request: AntiDetectRequests, data):
    response = request.get('https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg')
    print(response.content[:20])
    open('1.jpg','wb').write(response.content)

@request(use_stealth=True)
def with_stealth(request: AntiDetectRequests, data):
    response = request.get('https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg')
    print(response.content[:20])
    open('2.jpg','wb').write(response.content)


without_stealth()
with_stealth()
@Chetan11-dev
Copy link
Contributor

This will happen, I recommend going with hrequests for handling images.

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

2 participants