**------------------------------------------------------------------------------------------------ * @header_start * WebGrab+Plus ini for grabbing EPG data from TvGuide websites * @Site: canaaldigitaal.nl * @MinSWversion: 2.1.4 *@Revision 3 - [20/02/2019] ** * - showicon fix * @Revision 2 - [17/09/2017] Blackbear199 * - episode fix * @Revision 1 - [22/08/2017] Jan van Straaten * - changes in urldate * @Revision 0 - [16/08/2017] Jan van Straaten * - creation * @Remarks: uses attribute addition and runexe * @header_end **------------------------------------------------------------------------------------------------ site {url=canaldigitaal.nl|timezone=UTC|maxdays=8.1|cultureinfo=nl-NL|charset=UTF-8|titlematchfactor=90|nopageoverlaps|firstshow=1} site {ratingsystem=Kijkwijzer|episodesystem=onscreen} * url_preload {url|https://livetv.canaldigitaal.nl/tv-guide.aspx#!GuideType,CompleteGuide} url_index{url()|https://livetv.canaldigitaal.nl/api.aspx?z=epg&s=|channel|&cs=11583&f=##start##000&t=##end##000&f_format=pg&v=3&lng=nl&a=cds} * &cs=3391 also OK!! url_index.headers {customheader=Accept-Encoding=gzip,deflate,br} * to speedup the downloading of the index pages url_index.headers {accept=text/html, application/xhtml+xml, image/jxr, */*} url_index.headers {host=livetv.canaldigitaal.nl} url_index.headers {contenttype=application/x-javascript} urldate.format {datenumber|unix|0} scope.range{(urlindex)|end} index_variable_element.modify {calculate(format=F1)|'config_timespan_days' 1 +} index_variable_element.modify {calculate(format=timespan,days)} *index_temp_1.modify {calculate(format=date,yyyy/MM/dd)|'urldate'} index_temp_1.modify {calculate(format=date,yyyy/MM/dd)|'now'} index_temp_1.modify {calculate(format=date,unix)} index_temp_2.modify {calculate(format=date,unix)|'index_temp_1' 'index_variable_element' +} * url_index.modify {replace|##start##|'index_temp_1'} url_index.modify {replace|##end##|'index_temp_2'} end_scope scope.range {(splitindex)|end} index_showsplit.scrub {regex()||\{\"locId\".+?\}||} *index_showsplit.modify {(debug)} * lang attribute section, lookup table *global_temp_1.modify {set|nl} * the default *global_temp_1.modify {set('config_xmltv_id' ~ "mezzo")|fr} *global_temp_1.modify {set('config_xmltv_id' ~ "brava")|en} *global_temp_1.modify {set('config_xmltv_id' ~ "zdf")|de} * using external source global_temp_1.modify {set(type=run)|canaldigitaal.nl_lang.exe|canaldigitaal.nl_lang.xml "'config_xmltv_id'"} * result must be a two letter string index_temp_8.modify {calculate(type=char format=F0)|'global_temp_1' #} global_temp_1.modify {set('index_temp_8' not "2")|nl} * the default end_scope scope.range{(indexshowdetails)|end} index_temp_1.scrub {single(separator=":")|"locId":"||"|"} *locId *var locId = locId.replace(/-/g, "+").replace(/_/g, "/"); index_temp_1.modify {replace|-|+} index_temp_1.modify {replace|_|/} index_temp_1.modify {cleanup(style=base64decode,decimal)} *index_temp_1.modify {(debug)} * start time bytes index_temp_2.modify {substring(type=element)|'index_temp_1' 3 1} * byteArray[3] index_temp_3.modify {substring(type=element)|'index_temp_1' 4 1} * byteArray[4] index_temp_4.modify {substring(type=element)|'index_temp_1' 5 1} * byteArray[5] index_temp_5.modify {substring(type=element)|'index_temp_1' 6 1} * byteArray[6] * duration bytes index_temp_6.modify {substring(type=element)|'index_temp_1' 6 1} * byteArray[6] index_temp_7.modify {substring(type=element)|'index_temp_1' 7 1} * byteArray[7] * start time index_temp_2.modify {calculate(format=F0)|63 and} * & 63 index_temp_2.modify {calculate(format=F0)|1048576 *} * << 20 index_temp_3.modify {calculate(format=F0)|4096 *} * << 12 index_temp_4.modify {calculate(format=F0)|16 *} * << 4 index_temp_5.modify {calculate(format=F0)|240 and} * & 240 index_temp_5.modify {calculate(format=F0)|16 /} * >> 4 index_start.modify {calculate(format=F0)|'index_temp_2' + 'index_temp_3' + 'index_temp_4' + 'index_temp_5' + 60000 * 1325376000000 + 1000 /} * end start time * duration index_temp_6.modify {calculate(format=F0)|15 and} * & 15 index_duration.modify {calculate(format=F0)|'index_temp_6' + 'index_temp_7' +} * end duration *details index_title.scrub {regex()||","title":"(.+?)","||} index_title.modify {remove(type=regex)|^'} index_title.modify {replace| '| } index_description.scrub {regex()||","description":"(.+?)","||} index_description.modify {cleanup(style=jsondecode)} * episode (in description) index_temp_1.modify {clear} index_temp_1.modify {substring(type=regex)|'index_description' "\s*\(\s*(S\s\d+,\s*afl\.\s\d+\/\d+\|S\s\d+,\s*afl\.\s\d+\|S\s\d+\|alf\.\s\d+\/\d+\|alf\.\s\d+)\)"} * episode between () in description index_description.modify {remove('index_temp_1' not "" type=regex)|\(\s*'index_temp_1'\)} index_temp_1.modify {remove(type=regex)|S 0(?:,\s)?} * Season 0 has no meaning. index_episode.modify {set(pattern="S'S1'""afl.'E1'""S'S1',afl.'E1'""S'S1',afl.'E1'/'Et1'""afl.'E1'/'Et1'""E'E1'" 'index_temp_1' not "")|'index_temp_1'} * alternative episode solo "Aflevering n. in description index_temp_2.modify {clear} index_temp_2.modify {substring(type=regex)|'index_description' "\AAflevering\s*?(\d+?)\."} index_description.modify {remove('index_temp_2' not "" type=regex)|\AAflevering\s*?\d+?\.} index_temp_2.modify {addstart(not "")|E} index_episode.modify {set("")|'index_temp_2'} * this uses the last pattern "E'E1'"(see above) * both episode system attributes index_episode.modify {set('index_episode' not "")|'index_episode'\|'index_episode'(system=xmltv_ns)} * subtitle , like episode title. The first sentence of the desciption if there is an episode num. index_subtitle.modify {substring('index_episode' not "" type=sentence)|'index_description' 0 1} * The first sentence is not always the subtitle but often more a part of the description. The distinction is gaue. * we choose that a subtitle longer that 4 words remains description index_temp_3.modify {calculate(type=word format=F0)|'index_subtitle' #} index_subtitle.modify {clear('index_temp_3' > "4")} * if there is only 1 sentence in the description then there is no subtitle index_temp_3.modify {calculate(type=sentence format=F0)|'index_description' #} index_subtitle.modify {clear('index_temp_3' < "2")} * remove subtitle from description index_description.modify {remove('index_subtitle' not "" type=sentence)|0 1} * country and date (Nederland - 2016) (Nederland) (2016) index_productiondate.modify {substring(type=regex)|'index_description' "\([^\)]*(\d{4})\)"} index_productiondate.modify {cleanup(removeduplicates)} index_description.modify {remove('index_productiondate' not "" type=regex)|(?:\s-\s)?'index_productiondate'} index_description.modify {remove(type=regex)|\s*\(\)\s*} index_country.modify {substring(type=regex)|'index_description' "^[^\)]*\(([^\)]+)\)"} index_country.modify {clear(~ "/")} index_country.modify {clear(~ ", ")} index_description.modify {remove('index_country' not "" type=regex)|\s*\('index_country'\)\s*} *credits: index_description.modify {replace()|\\n|###} index_description.modify {replace()|\\r|.} index_actor.modify {substring(type=regex)|'index_description' "###\s*Cast:\s(.+?)\z"} index_actor.modify {replace|###|\|} index_actor.modify {remove|()} * remove empty role attribute index_actor.modify {replace(type=regex)|"(\s*\().+?\)\z"|(role=} * add role attribute index_description.modify {remove(type=regex)|"(###\s*Cast:\s.+?)\z"} * remove cast from description index_director.modify {substring(type=regex)|'index_description' "###\s*Regie:\s(.+?)\."} index_director.modify {replace|###|\|} index_description.modify {remove(type=regex)|"###\s*(Regie:\s.+?\.)"} * cleanup index_description.modify {remove|###} index_description.modify {cleanup} index_showicon.scrub {regex()||"cover":"(.*?)","||} index_showicon.modify {replace|epgimages/|epgimages/208x308/} index_showicon.modify {addstart(not"")|https://livetv.canaldigitaal.nl/} * add lang attribute index_title.modify {set|'index_title'(lang='global_temp_1')} index_description.modify {set(not "")|'index_description'(lang='global_temp_1')} index_subtitle.modify {set(not "")|'index_subtitle'(lang='global_temp_1')} index_country.modify {set(not "")|'index_country'(lang='global_temp_1')} end_scope ** _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ** ##### CHANNEL FILE CREATION (only to create the xxx-channel.xml file) ** ** @auto_xml_channel_start *url_index{url(preload="https://livetv.canaldigitaal.nl/tv-guide.aspx#!GuideType,CompleteGuide")|https://livetv.canaldigitaal.nl/api.aspx?z=epg&f_format=clx&lng=nl&streams=3&cs=79&d=3&v=3} *index_site_id.scrub {multi|"stationid":||,|,} *index_site_channel.scrub {multi|"title":"||"|"} *scope.range {(channellist)|end} *index_site_id.modify {cleanup(removeduplicates=equal,100 link="index_site_channel")} *end_scope ** @auto_xml_channel_end