diff --git a/pom.xml b/pom.xml index 372bc56..9e4d362 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ ch.srgssr playfff - 20 + 21 jar pfff diff --git a/src/main/resources/deeplink/v1/parsePlayUrl.js b/src/main/resources/deeplink/v1/parsePlayUrl.js index c68a95a..38a3897 100644 --- a/src/main/resources/deeplink/v1/parsePlayUrl.js +++ b/src/main/resources/deeplink/v1/parsePlayUrl.js @@ -1,6 +1,6 @@ // parsePlayUrl -var parsePlayUrlVersion = 23; +var parsePlayUrlVersion = 24; var parsePlayUrlBuild = "mmf"; if(! console) { @@ -20,19 +20,19 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch"): bu = "tp"; break; - case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")): + case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || (hostname.includes("play-web") && pathname.startsWith("/rts/")): bu = "rts"; break; - case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")): + case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || (hostname.includes("play-web") && pathname.startsWith("/rsi/")): bu = "rsi"; break; - case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")): + case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || (hostname.includes("play-web") && pathname.startsWith("/rtr/")): bu = "rtr"; break; - case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")): + case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || (hostname.includes("play-web") && pathname.startsWith("/swi/")): bu = "swi"; break; - case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")): + case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || (hostname.includes("play-web") && pathname.startsWith("/srf/")): bu = "srf"; break; case hostname.includes("play-mmf") && pathname.startsWith("/mmf/"): @@ -130,6 +130,12 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { pathname = pathname.substring(4); } + if (hostname.includes("play-web")) { + pathname = pathname.substring(4); + pathname = pathname.replace("/stage/play", "/play"); + pathname = pathname.replace("/test/play", "/play"); + } + /** * Catch special case: shared RTS media urls built by RTS MAM. * @@ -260,8 +266,9 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { * Catch live radio urls * * Ex: https://www.rsi.ch/play/radio/livepopup/rete-uno + * Ex: https://www.rsi.ch/play/radio/legacy-livepopup/rete-uno */ - if (pathname.includes("/radio/livepopup/")) { + if (pathname.includes("/radio/livepopup/") || pathname.includes("/radio/legacy-livepopup/")) { var mediaBu = null; var mediaId = null; switch (pathname.substr(pathname.lastIndexOf('/') + 1)) { @@ -785,5 +792,13 @@ function serverForUrl(hostname, pathname, queryParams) { } } } + else if (hostname.includes("play-web")) { + if (pathname.includes("/stage/play")) { + server = "stage"; + } + else if (pathname.includes("/test/play")) { + server = "test"; + } + } return server; } diff --git a/src/main/resources/deeplink/v2/parsePlayUrl.js b/src/main/resources/deeplink/v2/parsePlayUrl.js index bcc436b..8eceb55 100644 --- a/src/main/resources/deeplink/v2/parsePlayUrl.js +++ b/src/main/resources/deeplink/v2/parsePlayUrl.js @@ -1,6 +1,6 @@ // parsePlayUrl -var parsePlayUrlVersion = 23; +var parsePlayUrlVersion = 24; var parsePlayUrlBuild = "mmf"; if(! console) { @@ -102,6 +102,12 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { pathname = pathname.substring(4); } + if (hostname.includes("play-web")) { + pathname = pathname.substring(4); + pathname = pathname.replace("/stage/play", "/play"); + pathname = pathname.replace("/test/play", "/play"); + } + /** * Catch special case: shared RTS media urls built by RTS MAM. * @@ -232,8 +238,9 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { * Catch live radio urls * * Ex: https://www.rsi.ch/play/radio/livepopup/rete-uno + * Ex: https://www.rsi.ch/play/radio/legacy-livepopup/rete-uno */ - if (pathname.includes("/radio/livepopup/")) { + if (pathname.includes("/radio/livepopup/") || pathname.includes("/radio/legacy-livepopup/")) { var mediaBu = null; var mediaId = null; switch (pathname.substr(pathname.lastIndexOf('/') + 1)) { @@ -803,6 +810,14 @@ function serverForUrl(hostname, pathname, queryParams) { } } } + else if (hostname.includes("play-web")) { + if (pathname.includes("/stage/play")) { + server = "stage"; + } + else if (pathname.includes("/test/play")) { + server = "test"; + } + } return server; } @@ -810,15 +825,15 @@ function getBuFromHostname(hostname, pathname) { switch (true) { case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch"): return "tp"; - case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")): + case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || (hostname.includes("play-web") && pathname.startsWith("/rts/")): return "rts"; - case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")): + case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || (hostname.includes("play-web") && pathname.startsWith("/rsi/")): return "rsi"; - case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")): + case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || (hostname.includes("play-web") && pathname.startsWith("/rtr/")): return "rtr"; - case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")): + case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || (hostname.includes("play-web") && pathname.startsWith("/swi/")): return "swi"; - case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")): + case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || (hostname.includes("play-web") && pathname.startsWith("/srf/")): return "srf"; case hostname.includes("play-mmf") && pathname.startsWith("/mmf/"): return "mmf";