Skip to content

Commit

Permalink
Deeplink: add per channel TV guide urls (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyby authored May 11, 2024
1 parent e9d435f commit 47b2a64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/main/resources/deeplink/v1/parsePlayUrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// parsePlayUrl

var parsePlayUrlVersion = 41;
var parsePlayUrlVersion = 42;
var parsePlayUrlBuild = "mmf";

if (!console) {
Expand Down Expand Up @@ -566,7 +566,7 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) {
}

/**
* Catch by date TV urls
* Catch old by date TV urls
*
* Ex: https://www.rtr.ch/play/tv/emissiuns-tenor-data?date=07-03-2019
*/
Expand All @@ -587,13 +587,15 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) {
}

/**
* Catch new by date TV urls
* Catch new by date TV urls and TV program urls
*
* Ex: https://www.rts.ch/play/tv/emissions-par-dates/2021-06-21
* Ex: https://www.srf.ch/play/tv/programm/2021-07-03
* Ex: https://www.rsi.ch/play/tv/guidatv-per-canale/la-2/2024-05-11?channelUrn=urn%3Arsi%3Achannel%3Atv%3Ala2
*/
if (pathname.includes("/tv/sendungen-nach-datum") || pathname.includes("/tv/emissions-par-dates") || pathname.includes("/tv/programmi-per-data") || pathname.includes("/tv/emissiuns-tenor-data") ||
pathname.includes("/tv/programm") || pathname.includes("/tv/programme") || pathname.includes("/tv/guida-programmi") || pathname.includes("/tv/program")) {
pathname.includes("/tv/programm") || pathname.includes("/tv/programme") || pathname.includes("/tv/guida-programmi") || pathname.includes("/tv/program") ||
pathname.includes("/tv/programm-nach-sender") || pathname.includes("/tv/programme-par-chaine") || pathname.includes("/tv/guidatv-per-canale") || pathname.includes("/tv/tenor-program-tv")) {
var lastPathComponent = pathname.split("/").slice(-1)[0];

var date = null;
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/deeplink/v2/parsePlayUrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// parsePlayUrl

var parsePlayUrlVersion = 41;
var parsePlayUrlVersion = 42;
var parsePlayUrlBuild = "mmf";

if (!console) {
Expand Down Expand Up @@ -553,7 +553,7 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor, suppor
}

/**
* Catch by date TV urls
* Catch old by date TV urls
*
* Ex: https://www.rtr.ch/play/tv/emissiuns-tenor-data?date=07-03-2019
*/
Expand All @@ -577,9 +577,11 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor, suppor
*
* Ex: https://www.rts.ch/play/tv/emissions-par-dates/2021-06-21
* Ex: https://www.srf.ch/play/tv/programm/2021-07-03
* Ex: https://www.rsi.ch/play/tv/guidatv-per-canale/la-2/2024-05-11?channelUrn=urn%3Arsi%3Achannel%3Atv%3Ala2
*/
if (pathname.includes("/tv/sendungen-nach-datum") || pathname.includes("/tv/emissions-par-dates") || pathname.includes("/tv/programmi-per-data") || pathname.includes("/tv/emissiuns-tenor-data") ||
pathname.includes("/tv/programm") || pathname.includes("/tv/programme") || pathname.includes("/tv/guida-programmi") || pathname.includes("/tv/program")) {
pathname.includes("/tv/programm") || pathname.includes("/tv/programme") || pathname.includes("/tv/guida-programmi") || pathname.includes("/tv/program") ||
pathname.includes("/tv/programm-nach-sender") || pathname.includes("/tv/programme-par-chaine") || pathname.includes("/tv/guidatv-per-canale") || pathname.includes("/tv/tenor-program-tv")) {
var lastPathComponent = pathname.split("/").slice(-1)[0];

var date = null;
Expand Down Expand Up @@ -1113,7 +1115,7 @@ function buildUri(scheme, host, path, queryParams) {
if (path) {
uri = uri + "/" + path;
}
if (queryParams && queryParams !== {}) {
if (queryParams && Object.keys(queryParams).length > 0) {
uri = uri + "?";
var optionIndex = 0;
for (var option in queryParams) {
Expand Down

0 comments on commit 47b2a64

Please sign in to comment.