Os últimos anos conferiram à web uma nova dinâmica. Novos produtos e soluções inundam a nossa atenção a toda a hora, mas a verdadeira killer feature é a facilidade com que se constroem novos serviços sobre APIs. Building platforms é uma apresentação orientada a
developers sobre APIs e plataformas como Microformats, OpenID, OAuth.
19. Last.fm + Amazon ECS =
Recomendações
personalizadas de albuns
com reviews e e-store
20. Daylife + Technorati + Yahoo
Finance = Sistema para
correlacionar mercados e
notícias no mundo
(Que me tivesse dito com antecedência para comprar acções GALP) :-)
21. out: internet como plataforma
in: tudo é uma plataforma
data!
data!
data! data! data!
data!
data!
Web-apps sem API são desinteressantes.
22. “Can’t get enough of that
sweet, sweet data.”
Tom Coates @ Web 2.0 Expo
39. No API? No problem.
http://www.ruby-lang.org/en/
http://code.whytheluckystiff.net/hpricot/
http://mofo.rubyforge.org/
40. lojadocidadao.pt + hpricot =
O script anti-filas.
1 def update(serv)
2 a = Hpricot(open(serv))
3
4 a.search(quot;bquot;).each_with_index do |a, i|
5 if i == 1
6 pessoas = a.inner_html
7 elsif i == 2
8 tempomedio = a.inner_html
9 elsif i == 3
10 tempoat = a.inner_html
11 elsif i == 5
12 balcoes = a.inner_html
13 end
14 end
15 end
16
17 update(quot;http://www.lojadocidadao.pt/webiglc/inlineinclude.aspx?local=3&entidade=3&senha=Aquot;)
41. deviantart + hpricot + feed-
rss = Feed de wallpapers
url = quot;http://browse.deviantart.com/customization/wallpaper/animals/quot;
doc = Hpricot(open(url))
elements = (doc/quot;div.streamquot;)
#elements = (elements/quot;a.srcquot;)
pages = Array.new
html = elements.to_html
html.each('<') { |s|
s =~ /a href=quot;([^quot;]+)/
if Regexp.last_match(1) != nil
pages.push(Regexp.last_match(1))
end
}
pages.each { |s| p s }
42. wikipedia + hpricot =
Crawler de artigos
doc = Hpricot open('http://en.wikipedia.org/wiki/List_of_bicycle_manufacturing_companies')
@article = (doc/quot;#contentquot;).each do |content|
#change /wiki/ links to point to full wikipedia path
(content/:a).each do |link|
unless link.attributes['href'].nil?
if (link.attributes['href'][0..5] == quot;/wiki/quot;)
link.attributes['href'].sub!('/wiki/', 'http://en.wikipedia.org/wiki/')
end
end
end
#remove unnecessary content and edit links
items_to_remove.each { |x| (content/x).remove }
#replace links to create new entries with plain text
(content/quot;a.newquot;).each do |link|
link.parent.insert_before Hpricot.make(link.attributes['title']), link
end.remove
end