**------------------------------------------------------------------------------------------------ * @header_start * WebGrab+Plus ini for grabbing EPG data from TvGuide websites * @Site: tvtv.ca * @MinSWversion: V2.1 * @Revision 3 - [22/04/2020] WGT*add element (see note below!!) * @Revision 2 - [18/01/2020] WGT* ATTENTION !! need in folder \WebGrab+Plus\robots\tvtv.ca.robots to be read-only and with only 2 lines: * User-agent: * * User-agent: WebGrab+Plus * @Revision 1 - [07/09/2018] r00ty * Initial work on tvtv.us (and tvtv.ca separately) * @Remarks: * mostly json and on single page * @header_end **------------------------------------------------------------------------------------------------ site {url=tvtv.ca|timezone=UTC|maxdays=7|cultureinfo=en-US|charset=UTF-8|episodesystem=onscreen|ratingsystem=CA} * scope.range{(urlindex)|end} global_temp_1.modify{substring(type=regex)|'config_site_id' "\/(.*?)$"} global_temp_2.modify{substring(type=regex)|'config_site_id' "^(.*?)\/"} url_index.modify{replace|##prov##|'global_temp_2'} url_index.modify{replace|##chan##|'global_temp_1'} end_scope url_index {url|https://tvtv.ca/tvm/t/tv/v4/lineups/##prov##/listings/grid?detail=%27brief%27&start=|urldate|T00:00:00.000Z&end=|urldate|T23:59:00.000Z&startchan=##chan##&endchan=##chan##} ** url_index.headers {customheader=Accept-Encoding=gzip,deflate} * to speedup the downloading of the index pages urldate.format {datestring|yyyy-MM-dd} ** url_index.headers {accept=application/json, text/javascript, */*} ** index_showsplit.scrub {regex||"listings"\:\[\s*(\{.*?"showHost".*?\},?\s*)+.*?||} index_showsplit.modify {cleanup(style=jsondecode)} ** index_variable_element.modify {set|'config_site_id'} global_temp_3.scrub {regex||\{\s*"channel":\{.*?"logoFilename":"(.*?)"\,?.*?"listings".*]||} index_urlchannellogo.modify {addstart|https://tvtv.ca/tvm/i/image/station/100x100/'global_temp_3'} ** scope.range{(indexshowdetails)|end} index_start.scrub {single|"listDateTime"|:"|",|",} index_description.scrub {single|"description"|:"|",|",} index_title.scrub {single|"showName"|:"|",|",} index_subtitle.scrub {single|"episodeTitle"|:"|",|",} index_category.scrub {single|"showType"|:"|",|",,} index_rating.scrub {single|"rating"|:"|",|",} index_title.modify {replace("Movie")|'index_title'|'index_subtitle'} index_subtitle.modify {remove('index_title')|'index_subtitle'} index_director.scrub{single(separator=",")|"director":"||",|",} index_actor.scrub {single(separator=",")|"cast":"||",|",} index_productiondate.scrub{single|"year":"||",|",} index_showicon.scrub {url|https://cdn.tvpassport.com/image/show/480x720/|"poster":"||",|",} ** ** Some special handling for sports index_temp_3.scrub {single|"team1"|:"|",|",} index_temp_4.scrub {single|"team2"|:"|",|",} index_temp_5.scrub {single|"location"|:"|",|",} index_temp_6.scrub {single|"league"|:"|",|",} ** Show ID only for secondary lookup per show index_temp_7.scrub {single|"showID"|:|,} index_temp_8.modify {addstart('index_temp_3' not "")|'index_temp_3'} index_temp_8.modify {addend('index_temp_8' not "")| vs. 'index_temp_4'.} index_description.modify {addstart('index_temp_6' not "")|'index_temp_6' } index_description.modify {addend('index_temp_8' not "")| 'index_temp_8'} index_description.modify {addend('index_temp_5' not "")| 'index_temp_5'} index_subtitle.modify {addstart('index_subtitle' "")|'index_temp_8'} ** ** Split multiple categories index_category.modify {replace|,|\|} end_scope ** ** If you would like episode numbers, then uncomment the following lines. It will mean an extra web action per show (much slower) *index_urlshow.modify {addstart|https://tvtv.ca/tvm/t/tv/v4/episodes/'index_temp_7'} *scope.range{(showdetails)|end} *title.scrub{single|"seriesName"|:"|",|",} *temp_1.scrub {single|"seasonNumber"|:|,} *temp_2.scrub {single('temp_1' not "")|"seasonSeqNo"|:|,} *temp_1.modify {replace|0|} *temp_2.modify {replace|0|} *episode.modify {addstart('temp_2' not "")|S'temp_1'E'temp_2'} *end_scope ** End of episode number section ** ** _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ** ##### CHANNEL FILE CREATION (only to create the xxx-channel.xml file) ** ** Note, the 36625D is the line-up for Toronto Bell Fibre. You can get your own lineup by visiting http://tvtv.ca enter your location. ** It should then load a URL like: https://tvtv.ca/on/toronto/lu36625D for which you just take everything after "lu" as your lineup ID ** Then you can add a line like the following (replacing the site_id value with your own linup: ** tvtv Toronto ** It will then generate a channel file for your line-up ** ** @auto_xml_channel_start *url_index{url|https://tvtv.ca/tvm/t/tv/v4/lineups/|channel|} *index_temp_9.scrub{regex||"lineupID":"(.*?)","||} *index_site_channel.scrub {regex||"name":"(.*?)","callsign":"||} *index_site_id.scrub {regex||{"number":"(.*?)","channelNumber"||} *index_site_channel.modify {replace|\'|} *index_site_channel.modify {cleanup(style=jsondecode)} *index_site_id.modify {addstart|'index_temp_9'/} *scope.range {(channellist)|end} *index_site_id.modify {cleanup(removeduplicates=equal,100 link="index_site_channel")} *end_scope ** @auto_xml_channel_end