FIX qques bugs...
[pompage.git] / src / test.rb
index 9a4edba..dcc633c 100644 (file)
@@ -1,8 +1,18 @@
 # coding: utf-8\r
-html = '<table cellpadding="0" cellspacing="0" border="0" width="750" style="margin: 0 0 10 0;"><tr><td valign="top" width="120"><img src="http://a69.g.akamai.net/n/69/10688/v1/img5.allocine.fr/acmedia/medias/nmedia/18/35/06/77/afte.jpg" border="0" alt="" class="affichette" />'\r
-/<img src="(.*?)" border="0" alt="" class="affichette" \/>/ =~ html\r
-url = URI.parse($1)               \r
-p url.host\r
 \r
-nbRetry = 0\r
-p "youpla" if (nbRetry += 1) < 5     
\ No newline at end of file
+# doc : http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html\r
+Net::HTTP.version_1_2\r
+\r
+# hack : http://arosien.blogspot.com/2007/06/increasing-rubys-netbufferedio-buffer.html\r
+module Net\r
+   class BufferedIO\r
+      def rbuf_fill\r
+         timeout(@read_timeout) { @rbuf << @io.sysread(32768) }\r
+      end\r
+   end\r
+end\r
+\r
+connexion = Net::HTTP::new('www.allocine.fr').start\r
+connexion.finish\r
+html = connexion.get("/film/fichefilm_gen_cfilm=120576.html").body \r
+p html
\ No newline at end of file