Ruby Open-URI with Dynamic Website -


i'm trying use open-uri html page website. however, problem website needs couple of seconds load have correct code. have right is:

require 'open-uri'  html = open('http://hiddencode.me/dribbbucket/embed.html?key=my_api_key&bucket=56024-glassboard&delay=5000') response = html.read puts response 

if run right now, get:

<div id="slam-dunk">     <div id="loading">loading..</div> </div> 

however, site needs load first before opening correct response. ideas how in ruby? can use solution in language, if ruby not expertise!

as example, used watir-webdriver accomplish similar task. you'll able query dom after javascript execution , pull want out. if you'd headless, in case used headless gem.

if you'd stick 'open-uri' you'll have use httpfox watch ajax requests javascript makes. can many different tools well. you'd start httpfox, in case, before visit url. wait until see information you're trying scrape appear, stop httpfox , go through each request checking each response things relevant you're scraping. once identify proper request, may able use open-uri. while being simplest, solution not guaranteed web applications vary in how interact servers , manipulate dom.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -