dereksir

Untitled

Aug 9th, 2023
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import requests
  2. import json
  3.  
  4. url = "https://nowsecure.nl/"
  5. api_url = "http://localhost:8191/v1"
  6. headers = {"Content-Type": "application/json"}
  7.  
  8. data = {
  9.     "cmd": "request.get",
  10.     "url": url,
  11.     "maxTimeout": 60000
  12. }
  13.  
  14. response = requests.post(api_url, headers=headers, json=data)
  15.  
  16. # retrieve the entire JSON response from FlareSolverr
  17. response_data = json.loads(response.content)
  18.  
  19. # Extract the cookies from the FlareSolverr response
  20. cookies = response_data["solution"]["cookies"]
  21.  
  22. # Clean the cookies
  23. cookies = {cookie["name"]: cookie["value"] for cookie in cookies}
  24.  
  25. # Extract the user agent from the FlareSolverr response
  26. user_agent = response_data["solution"]["userAgent"]
  27.  
  28. response = requests.get(url, cookies=cookies, headers={"User-Agent": user_agent})
  29.  
Add Comment
Please, Sign In to add comment