[grilo-plugins] guardianvideos: Update for new API



commit 115c0f92e26e67e8fb6054bc109a050cee527707
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 23 15:29:27 2014 +0200

    guardianvideos: Update for new API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737176

 src/lua-factory/sources/grl-guardianvideos.lua |   11 +++++++----
 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]