[vlc-commits] Lua: fix Allocine for large result pages

Jean-Philippe André git at videolan.org
Sat Jan 22 14:45:22 CET 2011


vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Sat Jan 22 14:13:38 2011 +0100| [2a3c9b8eaee9a7b1dd6feda20ff8133e8ca5d002] | committer: Jean-Philippe André

Lua: fix Allocine for large result pages

Some pages are really huge, the only way we are sure we'll
be able to parse them is to download them entirely

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a3c9b8eaee9a7b1dd6feda20ff8133e8ca5d002
---

 share/lua/extensions/allocine-fr.lua |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/share/lua/extensions/allocine-fr.lua b/share/lua/extensions/allocine-fr.lua
index 5276985..927f0d9 100644
--- a/share/lua/extensions/allocine-fr.lua
+++ b/share/lua/extensions/allocine-fr.lua
@@ -157,8 +157,13 @@ function click_chercher()
     vlc.keep_alive()
 
     -- Fetch HTML data (max 65 kb)
-    local data = s:read(65535)
-    vlc.keep_alive()
+    local data = "", tmpdata
+    repeat
+       tmpdata = s:read(65535)
+       vlc.keep_alive()
+       if not tmpdata then break end
+       data = data .. tmpdata
+    until tmpdata == ""
 
     -- Clean data
     data = string.gsub(data, "<b>", "")



More information about the vlc-commits mailing list