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

How to send raw post? #254

Open
holden321 opened this issue Dec 14, 2021 · 4 comments
Open

How to send raw post? #254

holden321 opened this issue Dec 14, 2021 · 4 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@holden321
Copy link

I am trying to set header 'content-type: application/json' and post not encoded data in the request body;
So that it looks like this:
http://joxi.net/Dr86oRdFoOEZQ2

But FlareSolverr encode data (in param postData) and set header "content-type: application/x-www-form-urlencoded".
http://joxi.net/KAxzgBnhZPQ4Zm

Is it possible to say FlareSolverr not to encode body and not to set header content-type?

@ngosang
Copy link
Member

ngosang commented Jan 9, 2022

This feature is not supported and it can't be implemented because it's not supported by Puppeteer for Firefox. Related #266

You can write your own script to:

  • Make a regular GET request with FlareSolverr and save the Cookies and User-Agent returned.
  • Make a POST request without using FlareSolverr. You can use cURL, Python or any language but make sure you are setting the User-Agent and Cookie headers properly.

@ericluwj
Copy link

@ngosang
I used the method that you suggested, but I encountered the browser check by Cloudflare.
So then, I ironically had to utilize Puppeteer directly to make the POST request work.
Perhaps something can be worked out to make this easier.

@ngosang
Copy link
Member

ngosang commented Jan 16, 2022

You are doing something wrong. If you use the Cookies and the User-Agent provided by FlareSolverr it will work. There are several software out there using that method.

@norey
Copy link

norey commented Nov 28, 2022

I'm trying to follow your recommendation, about adding headers, using Python but It's not working. I'm getting a 403 with the "Checking if the site connection is secure... needs to review the security of your connection before proceeding" page.

data = {
 'cmd': 'request.get',
 'url': url,
 'session': 'sessid'
}
d = json.dumps(data)

r = requests.post('http://flaresolverr:8191/v1', data=d, headers={'Content-Type': 'application/json'})
js = r.json()

res = js.get('solution')

soup_download = BeautifulSoup(res.get('response'), 'lxml')
bs_url = soup_download.find(class_='downIt').get('href')

cookies = res.get('cookies')
userAgent = res.get('userAgent')

cookie = ''
for cook in cookies:
 cookie = cookie + cook['name'] + '=' + cook['value'] + ';'

headers = {
 'cookie': cookie,
 'user-agent': userAgent,
 'referer': 'https://referer.com/'
}

r = requests.post(bs_url, headers=headers)

print(r.status_code) # 403
print(r.text) # "Checking if the site connection is secure" page

Any idea what I might be doing wrong? I'm currently using version 2.2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants