**------------------------------------------------------------------------------------------------ * @header_start * WebGrab+Plus ini for grabbing EPG data from TvGuide websites * @Site: mtv3.fi * @MinSWversion: * @Revision 1 - [23/02/2016] * - creation * @Remarks: * @header_end **------------------------------------------------------------------------------------------------ site {url=mtv3.fi|timezone=WET|maxdays=21|cultureinfo=fi-FI|charset=UTF-8|titlematchfactor=90|episodesystem=xmltv_ns|ratingsystem=MEKU|keepindexpage} url_index{url|http://www.mtv.fi/asset/data/kanavaopas/tvopas-|urldate|-lite.json} url_index.headers {accept=application/json,text/plain|contenttype=application/json} url_index.headers {customheader=Accept-Encoding=gzip,deflate} urldate.format {datestring|yyyyMMdd} index_variable_element.modify {addend('index_variable_element' = "")|"'config_site_id'"} index_showsplit.scrub {regex||{[^}]+"channel":'index_variable_element'[^}]+}||} index_showsplit.modify {cleanup(style=jsondecode)} index_start.scrub {regex||"start_time":"?(\d+)"?,||} index_stop.scrub {regex||"end_time":"?(\d+)"?,||} index_title.scrub {regex||"name":"(.+?)","||} index_rating.scrub {regex||"age_rating":"?(.+?)"?,"||} index_rating.modify {remove|null} index_rating.modify {remove|-} index_category.scrub {regex||"program_type":"(.+?)","||} index_category.scrub {regex||"flag_children":(.+?),"||} index_category.modify {remove|null} index_category.modify {remove|false} index_category.modify {replace|true|lastenohjelmat} index_videoquality.scrub {regex||"flag_hd":(true),"||} index_videoquality.modify {replace|true|HD} *episode url has date in it. Sometimes we need the previous date. *http://www.mtv.fi/asset/data/kanavaopas/tvopas-20160223-full.json?NEL14562720001456275300 *index_temp_1 = date in UNIX time *index_temp_2 = previous date in UNIX time *index_temp_3 = program ID index_urlshow.modify {addstart|http://www.mtv.fi/asset/data/kanavaopas/tvopas-} index_temp_1.scrub {regex||"start_time":"?(\d+)"?,||} index_temp_2.modify {calculate(format=F0)|'index_temp_1' 86400 -} index_temp_1.modify {calculate(format=date,yyyyMMdd)} *convert UNIX date to yyyyMMdd index_temp_2.modify {calculate(format=date,yyyyMMdd)} *convert UNIX date to yyyyMMdd index_temp_3.scrub {regex||"progkey":"(.+?)"||} urlsubdetail.modify {addend|'index_urlshow''index_temp_1'-full.json?'index_temp_3'} urlsubdetail.modify {addend|####'index_urlshow''index_temp_2'-full.json?'index_temp_3'} urlsubdetail.modify {replace|####|\|} urlsubdetail.headers {accept=application/json,text/plain|contenttype=application/json} urlsubdetail.headers {customheader=Accept-Encoding=gzip,deflate} subdetail_title.scrub {regex||"name":"(.+?)","||} subdetail_title.modify {cleanup(style=jsondecode)} subdetail_subtitle.scrub {regex||"episode_name":"(.+?)","||} subdetail_subtitle.modify {cleanup(style=jsondecode)} subdetail_subtitle.modify {remove(type=regex)|^'subdetail_title'$} subdetail_description.scrub {regex||"description":"(.+?)","||} subdetail_description.modify {cleanup(style=jsondecode)} subdetail_description.modify {replace(type=regex)|\\\n| } subdetail_showicon.scrub {regex||"image_url":"(.+?)",||} ** _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ** ##### CHANNEL FILE CREATION (only to create the xxx-channel.xml file) ** ** @auto_xml_channel_start *index_site_channel.scrub {regex||"channel":"(.+?)","||} *index_site_id.scrub {regex||"channel":"(.+?)","||} *scope.range {(channellist)|end} *index_site_id.modify {cleanup(removeduplicates=equal,100 link="index_site_channel")} *end_scope ** @auto_xml_channel_end