Playing with YQL

May 17th, 2009

Note: this is an edited repost from Halans.com.

Have been playing with Yahoo!’s YQL this weekend, querying the Sydney Ferries website. Pretty amazing what it allows you to do, though the Sydney Ferries site wasn’t the best site to start playing with I guess. I did have a need to have the ferry timetable on my iPhone (especially the Neutral Bay service), so that’s why I put together Next Sydney Ferry this weekend.

The premise is pretty simple: when does the next ferry depart from Circular Quay? I had this wild idea to do cool stuff with it, but inspired by the simplicity of Next Manly Ferry, I thought I’d start out pretty simple too. And it certainly still is a work in progress with plenty of bugs.

NextSydneyFerry.com parses the timetables of the SydneyFerries.info site using YQL and JSONP. No luck with any API, so it’s pretty fragile reading in the HTML table data. Wish they made an effort marking up the data a bit more helpful (as in markup-as-an-api). One of the URLs even has a typo (“weekemd”). I additionally notice YQL not returning any results for the same query, while at other times it would, so they have some bugs too. It was an interesting YQL experiment, but since the data is not too dynamic, I will probably switch to using a more static datastore, which would also be a lot more responsive, and which would be lighter on your mobile dataplan. This is very much a first version application, with limited functionality (it shows you only the next and thereafter ferry, and only departing from Circular Quay), some noteworthy points:

  • it uses the server’s time so tourists don’t have to have their mobiles set to local time.
  • it updates the time in the background without a page refresh.
  • It allows you to bookmark your daily service.

Sydney Ferries allows you to repurpose their content, as long as you add their copyright notice and don’t charge for it. But they could have made it a lot easier for people to do so.

Category: Javascript

Author: JJ Halans

Tags: , , , ,

Custom non-visible data in HTML 5

July 14th, 2008

Short and sweet: HTML 5 offers custom data attributes on HTML elements, intended to store custom data, which can then be handled on-page by JavaScript, or off-page by other (web-)applications.

John Resig discusses a number of useful benefits.

Category: Javascript, Semantic Web

Author: JJ Halans

Tags: , , , , ,

The practice of POSH

February 7th, 2008

POSH stands for Plain Old Semantic HTML, and lets face it, POSH sounds better than semantic HTML. Check out the POSH checklist.

Poshformats on the other hand are various data formats constructed by using common, semantic class names, which are less formal than microformats. Whenever some one or some organisation creates a common class name, this is considered a ‘poshformat’, like for example the hRelease for pressreleases, or MacroID, a small decentralized verifiable identity format.

Andy Clarke talks about meaningful mark-up over at StuffAndNonsense, on The Fine Art of Markup and discusses What’s in a name, covering the conventions webdevelopers use in naming their id’s for page elements (way back in 2004). So, do you follow convention?

Picture by kk+

Category: Microformats, Semantic Web

Author: JJ Halans

Tags: , , ,

Scraping HTML with innerHTML or jQuery

September 11th, 2007

A couple of nice write-ups on how to scrape HTML using innerHTML at Pathfinder Development:

A common solution has been to proxy and scrape an application with a combination of XQuery and TagSoup (to fix the ugly, broken HTML, dontcha know), but it is possible to do this purely in the browser.

or with jQuery, as Jan Varwig describes:

Fortunately, just the day before, I discovered jQuery, a Javascript framework with strong support for finding DOM-Nodes via CSS, XPath and some custom selectors. The tricky part now was to get jQuery to access the DOM-Tree of the schedule page on kino.de.

Of course, screen scraping would be so much easier using Web Standards.

Category: Javascript, Semantic Web

Author: JJ Halans

Tags: , , , , , ,