Huginn: my problem about getting cookie

Created on 13 Nov 2018  路  3Comments  路  Source: huginn/huginn

I want to scrape new articles from this web page http://m.ebrun.com/top/original

it provides restful api, but it requires cookie to submit the get request.

when I requst the url with get method , it generates the cookie and save it locally.

and then the web refresh the request itself with the cookie.

My target is to send a get request with website agent and send the cookie in the reponse header to the next agent. How can I fullfil this ?

thank you.

Most helpful comment

You can use a PostAgent and set the method to get, change emit_events to true. You can try run the Agent and it should return the cookie in the headers section of the event. I also had to set disable_redirect_follow:

{
  "post_url": "http://m.ebrun.com/top/original",
  "expected_receive_period_in_days": "1",
  "content_type": "form",
  "method": "get",
  "payload": {},
  "headers": {},
  "emit_events": "true",
  "no_merge": "false",
  "output_mode": "clean",
  "disable_redirect_follow": "true"
}

All 3 comments

Hi, you can use this Scenario as an example. It logs into a Huginn instance using a cookie: https://huginnio.herokuapp.com/scenarios/19

I do not really get what the example said. My problem is how to get the cookie first. The site do not require me to log in by a post request with username and password. It just requires a get request and it will set cookie . Can i simulate this step by a certain agent? @dsander

You can use a PostAgent and set the method to get, change emit_events to true. You can try run the Agent and it should return the cookie in the headers section of the event. I also had to set disable_redirect_follow:

{
  "post_url": "http://m.ebrun.com/top/original",
  "expected_receive_period_in_days": "1",
  "content_type": "form",
  "method": "get",
  "payload": {},
  "headers": {},
  "emit_events": "true",
  "no_merge": "false",
  "output_mode": "clean",
  "disable_redirect_follow": "true"
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

scumola picture scumola  路  4Comments

holmesb picture holmesb  路  3Comments

TheReal1604 picture TheReal1604  路  4Comments

knu picture knu  路  9Comments

AnimusAstralis picture AnimusAstralis  路  4Comments