You are here

postdata

9 posts / 0 new
Last post
mariusz89b
Offline
Donator
Joined: 7 years
Last seen: 1 year
postdata

Hi,

I'm trying to learn how to use postdata with webgrab, what am I doing wrong that I'm not getting any response? If I prase it using python the response is just fine.

channel update="i" site="pl.canalplus.com" site_id="309" site_channel="http://m-tvguide.pl/ikony/PL/25.05.2021/tvn_24_pl.png" xmltv_id="TVN 24 PL">TVN 24 PL

**------------------------------------------------------------------------------------------------
* @header_start
* WebGrab+Plus ini for grabbing EPG data from TvGuide websites
* @Site: pl.canalplus.com
* @MinSWversion: V2.1
* @Revision 0 - [07/09/2021] Mariusz89b
* - creation
* @Remarks:
* @header_end
**------------------------------------------------------------------------------------------------
site {url=pl.canalplus.com|timezone=UTC|maxdays=7|cultureinfo=pl-PL|charset=UTF-8|titlematchfactor=90|nopageoverlaps}
*
site {episodesystem=onscreen} *Enable for Onscreen Episode System
*site {episodesystem=xmltv_ns} *Enable for xmltv_ns Episode System
*
url_index{url(debug)|https://pl.canalplus.com/iapi/tv-schedule/ProgramChannel)
*
urldate.format {datestring|yyyy-MM-dd}
*
index_variable_element.modify {addstart(scope=datelogo)|'config_site_channel'}
index_urlchannellogo.modify {addstart|'index_variable_element'}
*
scope.range{(urlindex)|end}
url_index.headers {method=POST}
url_index.headers {contenttype=application/json;charset=UTF-8}
url_index.headers {accept=application/json, text/plain, */*}
url_index.headers {postdata={"id":"'channel'","logical_date":"'urldate'"}}
end_scope
*
index_showsplit.scrub {regex(debug)||(.*?)||}

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 37 min

your postdata is wrong

mariusz89b
Offline
Donator
Joined: 7 years
Last seen: 1 year

But the request payload looks like this: {"id":"309","logical_date":"2021-09-07T00:00:00+02:00"}

I also tried writing it as a string postdata=id='channel'&logical_date='urldate' without luck.

How can it be wrong, what am I missing?

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 37 min

what is your urldate ? Is in format yyyy-MM-dd
so it will be 2021-09-07...what is missing compared to request postadata ?

mariusz89b
Offline
Donator
Joined: 7 years
Last seen: 1 year

Yes, so the missing part is T00:00:00+02:00 but when I tried using a python request the date 2021-09-07 was enough to get a response. I will read the documentation and try to add the missing part in webgrab.

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 37 min

you can just add it after urldate because it doesn't change
url_index.headers {postdata={"id":"'channel'","logical_date":"'urldate'T00:00:00+02:00"}}

mariusz89b
Offline
Donator
Joined: 7 years
Last seen: 1 year

hmm seems to me that the postdata is not the issue, Still not getting any response.

site {url=pl.canalplus.com|timezone=UTC|maxdays=7|cultureinfo=pl-PL|charset=UTF-8|titlematchfactor=90|nopageoverlaps}
*
site {episodesystem=onscreen} *Enable for Onscreen Episode System
*site {episodesystem=xmltv_ns} *Enable for xmltv_ns Episode System
*
url_index{url(debug)|https://pl.canalplus.com/iapi/tv-schedule/ProgramChannel)
*
urldate.format {datestring|yyyy-MM-dd}
*
index_variable_element.modify {addstart(scope=datelogo)|'config_site_channel'}
index_urlchannellogo.modify {addstart|'index_variable_element'}
*
url_index.headers {method=POST}
url_index.headers {customheader=Accept-Encoding=gzip,deflate,br}
url_index.headers {contenttype=application/json;charset=UTF-8}
url_index.headers {accept=application/json, text/plain, */*}
url_index.headers {postdata={"id":"'channel'","logical_date":"'urldate'T00:00:00+02:00"}}
*
index_showsplit.scrub {multi(debug)||||}

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 37 min

your url_index ends with wrong character should be }

mariusz89b
Offline
Donator
Joined: 7 years
Last seen: 1 year

Omg I must be blind, big thank you now it's working! :D

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl