lunes, 6 de diciembre de 2010

Tweaking the booking interface to make a RSS

No fancy hacking here, just a workaround to a lack of RSS feeds of Booking.com

This tweak works for me, as my city at the time of this writing only has 2 hotels, so its easy to show up in their "Recently booked" feed.

1. Go to http://feed43.com and start a new feed.
2. Copy your hotel's booking link
3. paste address where it says "Specify source page address (URL)" click "reload"
4. Define extraction rules, mine were:

Global Search Pattern:
< li id="hotel_id_259881" >{%}< /li >

Item (repeatable) Search Pattern:
data-roomname="{%}"{*}
< time datetime="{%}" >{*}
< strong >{%}< /strong >

Your rules probably won't be the same, play around. Click "extract".
In my case this gives me:
{ %1} = Double Room
{ %2} = 2010/11/24 15:23:12
{ %3} = 12 days, 17 minutes ago

5. Define output format. write whatever for the "Feed Title" options, but make sure you give "RSS item properties" some thought as this is where you format your item. In my case i formated this way:
Item Title Template: A { %1} was booked on { %2}. That is give or take { %3}!
Item Link Template: I used my affiliate ID, that way i get commission for my own bookings which is probably borderline against their rules
Item Content Template: blank

The output will be a RRS feed that checks booking.com for the latest bookings made, identifying only your hotel and formatting it to a string of your choice, Please note that i have put spaces on the HTML above as blogger sucks and doesn't allow code on the post.