summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <victortoso@gnome.org>2021-05-07 17:12:18 +0200
committerVictor Toso <victortoso@gnome.org>2021-10-04 08:38:37 +0000
commit340da5d552067b8a1738091f6a24b42ff07323b7 (patch)
tree8b6d64fbb007af63d95267ec34343a9662452d87
parent37625f190807027fba44e37b60a8b997c169973e (diff)
downloadgrilo-plugins-340da5d552067b8a1738091f6a24b42ff07323b7.tar.gz
euronews: adapt url to YouTube feeds
Euronews seemed to have migrated to YouTube for most of its content. At this moment, from the previous list of Feeds, only Persian is not exclusive YouTube. This patch uses the videoId provided by euronews to create an YouTube url. Fixes: https://gitlab.gnome.org/GNOME/grilo-plugins/-/issues/78
-rw-r--r--src/lua-factory/sources/grl-euronews.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lua-factory/sources/grl-euronews.lua b/src/lua-factory/sources/grl-euronews.lua
index d332fc7..d015593 100644
--- a/src/lua-factory/sources/grl-euronews.lua
+++ b/src/lua-factory/sources/grl-euronews.lua
@@ -82,13 +82,30 @@ function euronews_initial_fetch_cb(results, lang)
local json = {}
json = grl.lua.json.string_to_table(results)
- if not json or not json.url then
+ -- pfp: youtube, uses videoId for url
+ -- jw: will provide an url to request video
+ if not json or
+ (json.player ~= "pfp" and json.player ~= "jw") or
+ (json.player == "pfp" and not json.videoId) or
+ (json.player == "jw" and not json.url) then
local api_url = get_api_url(lang)
grl.warning ("Initial fetch failed for: " .. api_url)
callback_done()
return
end
+ if json.player == "pfp" then
+ item = {}
+ item.primary = string.format("https://www.youtube.com/watch?v=%s", json.videoId)
+ local media = create_media(lang, item)
+ if media ~= nil then
+ grl.callback(media, -1)
+ end
+
+ callback_done()
+ return
+ end
+
local streaming_lang = json.url:match("://euronews%-(..)%-p%-api")
if lang ~= LANG_EN and streaming_lang == LANG_EN then
grl.debug("Skipping " .. langs[lang] .. " as it redirects to " .. langs[LANG_EN] .. " stream.")