3rd party calendar
Is screen-scraper capable of running a 3rd party control that renders directly to the browser window?
I'm scraping this page: http://www.aptnewyork.com/04B100424
On the page if you click Availability to access the calendar it will load a 3rd party (Yahoo) calendar. It looks it's writing directly to the browser window using:
YAHOO.example.calendar.cal1.render();
The full script looks like this:
YAHOO.namespace("example.calendar");
YAHOO.example.calendar.init = function() {
YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:6});
YAHOO.example.calendar.cal1.addRenderer("01/01/2009-01/01/2012", YAHOO.example.calendar.cal1.renderCellStyleHighlight1);
YAHOO.example.calendar.cal1.render();
}
YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
For a third opinion--there's
For a third opinion--there's really no content to scrape, in this case. The JS is generating the entire calendar, apparently by referencing other code probably loaded in other .js files. Depending on exactly what information you're after, I think your best bet would be to try to reverse engineer the JS, then replicate what you need to in Interpreted Java within screen-scraper.
Jeremy, These types of
Jeremy,
These types of situations can be pretty convoluted. Here are some things I found to hopefully lead you in the right direction.
Compare the HTML from these two below and you'll notice only a small difference. Note the comment "By default all cells in green". The first one is how most of them look (most boxes are green). The second one has its boxes mostly red. Note the renderCellStyleHighlight3 in the second one.
Example 1 (JS source)
YAHOO.namespace("example.calendar");
YAHOO.example.calendar.init = function() {
YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:6});
<!-- By default all cells in green -->
YAHOO.example.calendar.cal1.addRenderer("01/01/2009-01/01/2012", YAHOO.example.calendar.cal1.renderCellStyleHighlight1);
YAHOO.example.calendar.cal1.render();
}
YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
</script>
Example 2 (JS source)
YAHOO.namespace("example.calendar");
YAHOO.example.calendar.init = function() {
YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:6});
<!-- By default all cells in green -->
YAHOO.example.calendar.cal1.addRenderer("01/01/2009-01/01/2012", YAHOO.example.calendar.cal1.renderCellStyleHighlight1);
YAHOO.example.calendar.cal1.addRenderer("01/01/2008-04/01/2012", YAHOO.example.calendar.cal1.renderCellStyleHighlight3);
YAHOO.example.calendar.cal1.render();
}
YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
</script>
Now, if you can make sense of their use of the dates then you might have an idea of why certain boxes are red and others are green.
I believe these two JS files render the display of the calendar, but they never change. So, the samples above are somehow controlling the way the calendar looks.
http://www.aptnewyork.com/yui/build/yahoo-dom-event/yahoo-dom-event.js
http://www.aptnewyork.com/yui/build/calendar/calendar-min.js
I hope this helps.
-Scott
We don't run any JavaScript,
We don't run any JavaScript, but you could see the HTTP request that this code is making, create a scrapeable file that emulates it, and scrape the response.