summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2014-09-23 13:29:27 (GMT)
committerBastien Nocera <hadess@hadess.net>2014-09-25 08:18:32 (GMT)
commit115c0f92e26e67e8fb6054bc109a050cee527707 (patch)
tree75e155af44ba8514ca9de4d0affcaccaf6b0187f
parent2dbe7d4767bbaf76c4d500edb49706fff3464b5f (diff)
downloadgrilo-plugins-115c0f92e26e67e8fb6054bc109a050cee527707.zip
grilo-plugins-115c0f92e26e67e8fb6054bc109a050cee527707.tar.xz
guardianvideos: Update for new API
https://bugzilla.gnome.org/show_bug.cgi?id=737176
-rw-r--r--src/lua-factory/sources/grl-guardianvideos.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lua-factory/sources/grl-guardianvideos.lua b/src/lua-factory/sources/grl-guardianvideos.lua
index 59f68fa..114c5d1 100644
--- a/src/lua-factory/sources/grl-guardianvideos.lua
+++ b/src/lua-factory/sources/grl-guardianvideos.lua
@@ -20,7 +20,10 @@
*
--]]
-GUARDIANVIDEOS_URL = 'http://content.guardianapis.com/search?tag=video&page=%s&page-size=%s&show-fields=all'
+-- Test the API at:
+-- http://explorer.content.guardianapis.com/search?api-key=rppwmmu3mfqj6gkbs8kcjg23&show-fields=all&page-size=50&tag=type/video
+API_KEY = 'rppwmmu3mfqj6gkbs8kcjg23'
+GUARDIANVIDEOS_URL = 'http://content.guardianapis.com/search?tag=type/video&page=%s&page-size=%s&show-fields=all&api-key=%s'
---------------------------
-- Source initialization --
@@ -47,15 +50,15 @@ function grl_source_browse(media_id)
local page = skip / count + 1
if page > math.floor(page) then
- local url = string.format(GUARDIANVIDEOS_URL, math.floor(page), count)
+ local url = string.format(GUARDIANVIDEOS_URL, math.floor(page), count, API_KEY)
grl.debug ("Fetching URL #1: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
table.insert(urls, url)
- url = string.format(GUARDIANVIDEOS_URL, math.floor(page) + 1, count)
+ url = string.format(GUARDIANVIDEOS_URL, math.floor(page) + 1, count, API_KEY)
grl.debug ("Fetching URL #2: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
table.insert(urls, url)
else
- local url = string.format(GUARDIANVIDEOS_URL, page, count)
+ local url = string.format(GUARDIANVIDEOS_URL, page, count, API_KEY)
grl.debug ("Fetching URL: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
table.insert(urls, url)
end