**------------------------------------------------------------------------------------------------
* @header_start
* WebGrab+Plus ini for grabbing EPG data from TvGuide websites
* @Site: tv.nu
* @MinSWversion: V1.1.1/55.27
* needs nopageoverlap
* @Revision 7 - [08/07/2017] GenIPTV
* added total episodes, total seasons, productiondate and country
* @Revision 6 - [08/11/2015] Jan van Straaten
* again: adjust to new site changes
* @Revision 5 - [02/09/2015] Francis De Paemeleere
* adjust to site changes
* @Revision 4 - [24/04/2013] Jan van Straaten
* small change in index_start, adapted to site change.
* @Revision 3 - [06/11/2012] Jan van Straaten
* Urldate.format, for today - idag - no value in the list (site change)
* @Revision 2 - []
* small change in showsplit, added nopageoverlap
* @Revision 1 - []
* added category and productiondate, removed html tags in description
* @Revision 0 - []
* none
* @Remarks:
* @header_end
**------------------------------------------------------------------------------------------------
site {url=tv.nu|timezone=Europe/Stockholm|maxdays=9|cultureinfo=sv-SE|charset=UTF-8|titlematchfactor=90|nopageoverlap}
site {ratingsystem=tv.nu|episodesystem=xmltv_ns}
*url_index{url|http://www.tv.nu/kanal/|channel||urldate} * windows
url_index{url|http://127.0.0.1/channels/tv_nu.php?urldate=|urldate|&channel=|channel|} * linux
urldate.format {list||/imorgon|{weekdayname|/mandag|/tisdag|/onsdag|/torsdag|/fredag|/lordag|/sondag}}
*index_showsplit.scrub {multi|class="milli js-broadcast" |||}
index_showsplit.scrub {regex||
||}
index_urlchannellogo.scrub {regex||class="js-channel-navigation".*?]*>([^<]*)||}
index_urlshow.modify {addstart|http://www.tv.nu/api/broadcasts/'index_temp_1'}
index_urlshow.headers {customheader=X-Requested-With=XMLHttpRequest} * to speedup the downloading of the detail pages
index_urlshow.headers {customheader=Accept-Encoding=gzip,deflate} * to speedup the downloading of the detail pages
title.scrub {regex||^.*?"title"\s*:\s*"([^"\\]*(?:\\.[^"\\]*)*)"||}
title.modify {cleanup(style=jsondecode)}
temp_1.scrub {regex||^.*?"seasonNumber"\s*:\s*([+-]?\d*)||}
temp_2.scrub {regex||^.*?"episodeNumber"\s*:\s*([+-]?\d*)||}
temp_3.scrub {regex()||^.*?\"releaseYear\"\s*:\s*[+-]?\d*,\"totalEpisodes\"\s*:\s*([+-]?\d*),||}
temp_4.scrub {single()|"totalSeasons":||,|,}
subtitle.scrub {regex||^.*?"episodeTitle"\s*:\s*"([^"\\]*(?:\\.[^"\\]*)*)"||}
subtitle.modify {cleanup(style=jsondecode)}
actor.scrub {regex||"role":"Sk\\u00e5despelare"[^{]*?"person":\{([^}]*?)\}||}
actor.modify {substring(type=regex)|("firstName":"[^"\\]*(?:\\.[^"\\]*)*","middleName":"[^"\\]*(?:\\.[^"\\]*)*","lastName":"[^"\\]*(?:\\.[^"\\]*)*")}
actor.modify {remove|"firstName":"}
actor.modify {replace|","middleName":"| }
actor.modify {replace|","lastName":"| }
actor.modify {remove(type=regex)|"$}
actor.modify {replace| | }
actor.modify {cleanup(style=jsondecode)}
director.scrub {regex||"role":"Regiss\\u00f6r"[^{]*?"person":\{([^}]*?)\}||}
director.modify {substring(type=regex)|("firstName":"[^"\\]*(?:\\.[^"\\]*)*","middleName":"[^"\\]*(?:\\.[^"\\]*)*","lastName":"[^"\\]*(?:\\.[^"\\]*)*")}
director.modify {remove|"firstName":"}
director.modify {replace|","middleName":"| }
director.modify {replace|","lastName":"| }
director.modify {remove(type=regex)|"$}
director.modify {replace| | }
director.modify {cleanup(style=jsondecode)}
category.scrub {regex||^.*?"genres"\s*:\s*\["(?:((?:[^"\\]*?(?:\\.[^"\\]*?)*?))",{0,1})*?]||}
category.modify {cleanup(style=jsondecode)}
*showicon.scrub {regex||"episode"[^\{]*\{[^\{]*"imageRelation":\s*{[^\{]*"image":\s*{*{[^\{]*"url"\s*:\s*"([^"\\]*(?:\\.[^"\\]*)*)"||}
showicon.scrub {regex||"episode".*?"program":\s*{[^\{]*"imageRelation":\s*{[^\{]*"image":\s*{*{[^\{]*"url"\s*:\s*"([^"\\]*(?:\\.[^"\\]*)*)"||}
showicon.modify {cleanup(style=jsondecode)}
* temp_1 = season
* temp_4 = total seasons
* temp_2 = episode
* temp_3 = total episodes
temp_1.modify {calculate(not="" format=F0)|1 -}
temp_1.modify {addend('temp_4' not "")|/'temp_4'}
temp_2.modify {calculate(not="" format=F0)|1 -}
temp_2.modify {addend('temp_3' not "")|/'temp_3'}
episode.modify {clear}
episode.modify {addend('temp_1' not="")|'temp_1'}
episode.modify {addend|.}
episode.modify {addend('temp_2' not="")|'temp_2'}
episode.modify {addend|.}
episode.modify {clear(="..")}
productiondate.scrub {single()|"releaseYear":||,|,}
productiondate.scrub {single('productiondate' "")|"year":||,|,}
country.scrub {single()|"country":|["|"],|"],}
** _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
** ##### CHANNEL FILE CREATION (only to create the xxx-channel.xml file)
**
** @auto_xml_channel_start
*url_index{url|http://www.tv.nu/kanal-bibliotek/alla-kanaler-alla-kanaler} * windows
*url_index{url|http://127.0.0.1/channels/tv_nu.php} * linux
*index_site_channel.scrub {regex||data-name="([^"]*)"\s+data-slug="[^\"]*"||}
*index_site_id.scrub {regex||data-name="[^"]*"\s+data-slug="([^\"]*)"||}
*scope.range {(channellist)|end}
*index_site_id.modify {cleanup(removeduplicates=equal,100 link="index_site_channel")}
*end_scope
** @auto_xml_channel_end