Created
July 17, 2009 19:26
-
-
Save mperham/149234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string =<<-EOX | |
<?xml version="1.0" encoding="utf-8" ?><Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xml.truveo.com" | |
xsi:schemaLocation="http://xml.truveo.com/apiv3.xsd"><method>truveo.videos.getVideos</method><query>iphone</query><queryCategory>default</queryCategory> | |
<partialMatch>0</partialMatch><VideoSet><totalResultsAvailable>218367</totalResultsAvailable><totalResultsReturned>10</totalResultsReturned><firstResultPosition>0</firstResultPosition> | |
<title>Iphone Videos</title><rssUrl>http://xml.truveo.com/rss?query=iphone&showAdult=0&a=8466e666a2b70e9599b8d92d6c238d70</rssUrl><embedTag><embed src="http://www.truveo.com/truveo_listWidget.swf?query=iphone&resultsnum=10" quality="high" wmode="transparent" type="application/x-shockwave-flash" width="600" height="150"></embed></embedTag><Video><id>1600467146</id><title>'Top Gun' for the iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=1609875734&a=8466e666a2b70e9599b8d92d6c238d70&p=1&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>USA TODAY</channel><channelUrl>http://www.usatoday.com/</channelUrl><dateFound>Fri, 17 Jul 2009 11:15:26 -0400</dateFound><textRelevancy>385</textRelevancy><vRank>0.505277</vRank><description>AP’s weekly Video Game Video finds the latest "Top Gun" game features plenty of "Danger Zone," a bit of Maverick &#8212; and plays on your iPhone. (July 17)</description><referrerPageUrl>http://www.usatoday.com/</referrerPageUrl><runtime>94</runtime><category>Entertainment</category><country>United States</country><language>English</language><dateProduced>2009-07-17T07:42:20.963-07:00</dateProduced><thumbnailUrl>http://thumbnails.truveo.com/0011/87/72/8772A2B1EEB79A29489D5D.jpg</thumbnailUrl><videoResultEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/1609875734/a/8466e666a2b70e9599b8d92d6c238d70/p/1" id='embeddedplayer' pluginspage='http://www.macromedia.com/go/getflashplayer' menu='false' quality='high' play='false' name='immersiveproduction' height=' 405' width=' 425' allowFullScreen='true' allowScriptAccess='always' scale='exactfit' salign='LT' bgcolor='#000000' wmode='window' flashvars='playerId=immersiveproduction&referralObject=1185770449&referralPlaylistId=playlist'' /></videoResultEmbedTag><adultFlag>0</adultFlag><videoPlayerEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/1609875734/a/8466e666a2b70e9599b8d92d6c238d70/p/1" id='embeddedplayer' pluginspage='http://www.macromedia.com/go/getflashplayer' menu='false' quality='high' play='false' name='immersiveproduction' height=' 405' width=' 425' allowFullScreen='true' allowScriptAccess='always' scale='exactfit' salign='LT' bgcolor='#000000' wmode='window' flashvars='playerId=immersiveproduction&referralObject=1185770449&referralPlaylistId=playlist'' /></videoPlayerEmbedTag><formats>flash</formats></Video><Video><id>3931880598</id><title>'Top Gun' for the iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=3928634477&a=8466e666a2b70e9599b8d92d6c238d70&p=2&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>omg!</channel><channelUrl>http://omg.yahoo.com/</channelUrl><dateFound>Fri, 17 Jul 2009 14:51:38 -0400</dateFound> | |
<textRelevancy>397</textRelevancy><vRank>0.498992</vRank><description>AP’s weekly Video Game Video finds the latest "Top Gun" game features plenty of "Danger Zone," a bit of Maverick &#8212; and plays on your iPhone. (July 17)</description><referrerPageUrl>http://omg.yahoo.com/</referrerPageUrl><distributor>Associated Press</distributor><runtime>94</runtime><category>Entertainment</category><country>United States</country><language>English</language><dateProduced>July 17, 2009 7:40 AM PDT</dateProduced><thumbnailUrl>http://thumbnails.truveo.com/0010/32/20/3220CAC632978E6705BCBC.jpg</thumbnailUrl><videoResultEmbedTag><embed src="http://www.truveo.com/truveo_videoWidget.swf?query=id:3931880598" wmode="transparent" type="application/x-shockwave-flash" width="425" height="110"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><formats>flash</formats></Video><Video><id>2013553331</id><title>Tapped-In: Hidden Gems of iPhone 3.0</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=2013373404&a=8466e666a2b70e9599b8d92d6c238d70&p=3&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>FOX News</channel><channelUrl>http://www.foxnews.com</channelUrl><dateFound>Mon, 13 Jul 2009 17:57:23 -0400</dateFound><textRelevancy>359</textRelevancy><vRank>0.49417</vRank><description>What you may not know about the new OS</description><referrerPageUrl>http://www.foxnews.com/video/index.html</referrerPageUrl><runtime>157</runtime><category>News</category><tags>News, copy, Tapped-in, Hints, Application, photo sharing, e-mail, Tapped, copy and paste, Review, iPhone, Mobile, Tips, App, Fox, paste, Tip, iPhone 3.0, Apps, recommendations, Reviews, OS, Tips and Tricks, Apple, Gems, recommendation, Tips & Tricks, 3.0, Tricks, Tap, Applications</tags><country>United States</country><language>English</language><dateProduced>2009-07-13T17:51:54.054-0400</dateProduced><viewCount>7</viewCount><thumbnailUrl>http://thumbnails.truveo.com/0009/A4/F5/A4F5A1D5433B6A60E9EADB.jpg</thumbnailUrl><thumbnailUrlLarge>http://thumbnails.truveo.com/0009/A4/F5/A4F5A1D5433B6A60E9EADB_Large.jpg</thumbnailUrlLarge><videoResultEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/2013373404/a/8466e666a2b70e9599b8d92d6c238d70/p/3" id='mediumFlashEmbedded' pluginspage='http://www.macromedia.com/go/getflashplayer' bgcolor='#000000' allowScriptAccess='always' allowFullScreen='true' quality='high' name='undefined' play='false' scale='exactfit' menu='false' salign='LT' scriptAccess='always' wmode='false' height=' 383' width=' 425' flashvars='playerId=videolandingpage&playerTemplateId=fncLargePlayer&categoryTitle=&referralObject=6851801&referralPlaylistId=playlist' /></videoResultEmbedTag><adultFlag>0</adultFlag><videoPlayerEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/2013373404/a/8466e666a2b70e9599b8d92d6c238d70/p/3" id='mediumFlashEmbedded' pluginspage='http://www.macromedia.com/go/getflashplayer' bgcolor='#000000' allowScriptAccess='always' allowFullScreen='true' quality='high' name='undefined' play='false' scale='exactfit' menu='false' salign='LT' scriptAccess='always' wmode='false' height=' 383' width=' 425' flashvars='playerId=videolandingpage&playerTemplateId=fncLargePlayer&categoryTitle=&referralObject=6851801&referralPlaylistId=playlist' /></videoPlayerEmbedTag><formats>flash</formats></Video><Video><id>1573568154</id><title>Teen iPhone Hacker Nurses App Dreams</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=1566991692&a=8466e666a2b70e9599b8d92d6c238d70&p=4&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>MarketWatch</channel><channelUrl>http://www.marketwatch.com</channelUrl><dateFound>Mon, 06 Jul 2009 20:19:55 -0400</dateFound><textRelevancy>353</textRelevancy><vRank>0.493299</vRank><description>Teen hacker Ari Weinstein captured a share of Internet notoriety when he became the first hacker to break into an Apple iPhone. But now, he’s trying to go legit, as he spends his summer tooling up a new app.&#32;&#32;Yukari Iwatani Kane reports from Pennsylvania.</description><referrerPageUrl>http://www.marketwatch.com</referrerPageUrl><runtime>201</runtime><category>Business</category><country>United States</country><language>English</language><viewCount>64</viewCount><userRating>3</userRating><userRatingCount>5</userRatingCount><thumbnailUrl>http://wsj.vo.llnwd.net/o28/video/20090706/070609applehak/070609applehak_167x94.jpg</thumbnailUrl><videoResultEmbedTag><embed src="http://xml.truveo.com/eb/i/1566991692/a/8466e666a2b70e9599b8d92d6c238d70/p/4" bgcolor="#FFFFFF" flashVars="videoGUID={40FE452F-CECB-482D-9409-601A96CC3008}&playerid=2000&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/" name="flashPlayer" width=" 425" height=" 301" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><videoPlayerEmbedTag><embed src="http://xml.truveo.com/eb/i/1566991692/a/8466e666a2b70e9599b8d92d6c238d70/p/4" bgcolor="#FFFFFF" flashVars="videoGUID={40FE452F-CECB-482D-9409-601A96CC3008}&playerid=2000&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/" name="flashPlayer" width=" 425" height=" 301" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></videoPlayerEmbedTag><formats>flash</formats></Video><Video><id>1055745171</id><title>Jailbreak iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=1052587942&a=8466e666a2b70e9599b8d92d6c238d70&p=5&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>FOX News</channel><channelUrl>http://www.foxnews.com</channelUrl><dateFound>Mon, 13 Jul 2009 17:25:44 -0400</dateFound><textRelevancy>341</textRelevancy><vRank>0.491513</vRank><description>15-year-old hacker outsmarts Apple</description><referrerPageUrl>http://www.foxnews.com/video/index.html</referrerPageUrl><runtime>219</runtime><category>News</category><tags>I-PHONE, FOX_Friends, Steve Doocy, HACKER, ARI WEINSTEIN, apple, cell, Gretchen Carlson, Brian Kilmeade</tags><showName>FOX & Friends</showName><country>United States</country><language>English</language><dateProduced>2009-07-13T10:10:43.043-0400</dateProduced><viewCount>40</viewCount><thumbnailUrl>http://thumbnails.truveo.com/0006/A9/C0/A9C0A0223964DFCDE48A78.jpg</thumbnailUrl><thumbnailUrlLarge>http://thumbnails.truveo.com/0006/A9/C0/A9C0A0223964DFCDE48A78_Large.jpg</thumbnailUrlLarge><videoResultEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/1052587942/a/8466e666a2b70e9599b8d92d6c238d70/p/5" id='mediumFlashEmbedded' pluginspage='http://www.macromedia.com/go/getflashplayer' bgcolor='#000000' allowScriptAccess='always' allowFullScreen='true' quality='high' name='undefined' play='false' scale='exactfit' menu='false' salign='LT' scriptAccess='always' wmode='false' height=' 383' width=' 425' flashvars='playerId=videolandingpage&playerTemplateId=fncLargePlayer&categoryTitle=&referralObject=6838198&referralPlaylistId=playlist' /></videoResultEmbedTag><adultFlag>0</adultFlag><videoPlayerEmbedTag><embed type='application/x-shockwave-flash' src="http://xml.truveo.com/eb/i/1052587942/a/8466e666a2b70e9599b8d92d6c238d70/p/5" id='mediumFlashEmbedded' pluginspage='http://www.macromedia.com/go/getflashplayer' bgcolor='#000000' allowScriptAccess='always' allowFullScreen='true' quality='high' name='undefined' play='false' scale='exactfit' menu='false' salign='LT' scriptAccess='always' wmode='false' height=' 383' width=' 425' flashvars='playerId=videolandingpage&playerTemplateId=fncLargePlayer&categoryTitle=&referralObject=6838198&referralPlaylistId=playlist' /></videoPlayerEmbedTag><formats>flash</formats></Video><Video><id>2560650780</id><title>'Top Gun' For The iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=2561688307&a=8466e666a2b70e9599b8d92d6c238d70&p=6&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>WPLG Miami</channel><channelUrl>http://www.Local10.com</channelUrl><dateFound>Fri, 17 Jul 2009 13:22:32 -0400</dateFound><textRelevancy>385</textRelevancy><vRank>0.489949</vRank><description>The latest "Top Gun" game features plenty of "Danger Zone," a bit of Maverick &#8212; and plays on your iPhone.</description><referrerPageUrl>http://www.Local10.com</referrerPageUrl><copyright>Copyright 2009, Internet Broadcasting Systems, Inc</copyright><category>News</category><language>English</language><dateProduced>Fri, 17 Jul 2009 12:29:29 EDT</dateProduced><thumbnailUrl>http://thumbnails.truveo.com/0009/A0/AC/A0AC8EB793E95EA5B89D2B.jpg</thumbnailUrl><thumbnailUrlLarge>http://thumbnails.truveo.com/0009/A0/AC/A0AC8EB793E95EA5B89D2B_Large.jpg</thumbnailUrlLarge><videoResultEmbedTag><embed src="http://www.truveo.com/truveo_videoWidget.swf?query=id:2560650780" wmode="transparent" type="application/x-shockwave-flash" width="425" height="110"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><formats>win</formats></Video><Video><id>575714071</id><title>Teen iPhone Hacker Nurses App Dreams</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=572277859&a=8466e666a2b70e9599b8d92d6c238d70&p=7&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>The Wall Street Journal</channel><channelUrl>http://online.wsj.com</channelUrl><dateFound>Mon, 06 Jul 2009 20:40:10 -0400</dateFound><textRelevancy>363</textRelevancy><vRank>0.487379</vRank><description>Teen hacker Ari Weinstein captured a share of Internet notoriety when he became the first hacker to break into an Apple iPhone. But now, he’s trying to go legit, as he spends his summer tooling up a new app.&#32;&#32;Yukari Iwatani Kane reports from Pennsylvania.</description><referrerPageUrl>http://online.wsj.com</referrerPageUrl><copyright>Copyright 2009, Dow Jones & Company, Inc.</copyright><runtime>201</runtime><category>Technology</category><tags>air weinstein, apple, iphone, apple iphone, yukari iwatani kane, jailbreak, ipod touch</tags><country>United States</country><language>English</language><dateProduced>Mon, 06 Jul 2009 23:50:13 GMT</dateProduced><viewCount>100</viewCount><thumbnailUrl>http://wsj.vo.llnwd.net/o28/video/20090706/070609applehak/070609applehak_167x94.jpg</thumbnailUrl><videoResultEmbedTag><embed src="http://xml.truveo.com/eb/i/572277859/a/8466e666a2b70e9599b8d92d6c238d70/p/7" bgcolor="#FFFFFF" flashVars="videoGUID={40FE452F-CECB-482D-9409-601A96CC3008}&playerid=1000&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/" name="flashPlayer" width=" 425" height=" 301" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><videoPlayerEmbedTag><embed src="http://xml.truveo.com/eb/i/572277859/a/8466e666a2b70e9599b8d92d6c238d70/p/7" bgcolor="#FFFFFF" flashVars="videoGUID={40FE452F-CECB-482D-9409-601A96CC3008}&playerid=1000&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/" name="flashPlayer" width=" 425" height=" 301" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></videoPlayerEmbedTag><formats>flash</formats></Video><Video><id>208554356</id><title>'Top Gun' for the iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=216123714&a=8466e666a2b70e9599b8d92d6c238d70&p=8&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>AP Video</channel><channelUrl>http://video.ap.org</channelUrl><dateFound>Fri, 17 Jul 2009 10:39:25 -0400</dateFound><textRelevancy>385</textRelevancy><vRank>0.486922</vRank><description>AP’s weekly Video Game Video finds the latest "Top Gun" game features plenty of "Danger Zone," a bit of Maverick &#8212; and plays on your iPhone. (July 17)</description><referrerPageUrl>http://video.ap.org</referrerPageUrl><category>News</category><tags>Showbiz</tags><country>United States</country><language>English</language><thumbnailUrl>http://thumbnails.truveo.com/0006/96/CD/96CDF13B6B645856111A34.jpg</thumbnailUrl><thumbnailUrlLarge>http://thumbnails.truveo.com/0006/96/CD/96CDF13B6B645856111A34_Large.jpg</thumbnailUrlLarge><videoResultEmbedTag><embed src="http://www.truveo.com/truveo_videoWidget.swf?query=id:208554356" wmode="transparent" type="application/x-shockwave-flash" width="425" height="110"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><formats>flash</formats></Video><Video><id>1077033400</id><title>Police Not Too Happy With New iPhone App</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=1075715903&a=8466e666a2b70e9599b8d92d6c238d70&p=9&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>Yahoo! News</channel><channelUrl>http://news.yahoo.com</channelUrl><dateFound>Fri, 17 Jul 2009 03:25:23 -0400</dateFound><textRelevancy>385</textRelevancy><vRank>0.486543</vRank><description>If you have the need for speed, a new iPhone app locates where police check for speeders, as well as red light cameras. But police aren’t too happy about it. Kiet Do reports.</description><referrerPageUrl>http://news.yahoo.com/video</referrerPageUrl><distributor>CBS 5 San Francisco</distributor><category>News</category><country>United States</country><language>English</language><dateProduced>Friday, July 17, 2009 12:24:15 AM</dateProduced><thumbnailUrl>http://d.yimg.com/a/p/cbs_local/20090717/vidlthumb.c5fc4fbf7362e1f8ebaeb3c5ecdf61cd.jpg</thumbnailUrl><videoResultEmbedTag><embed src="http://www.truveo.com/truveo_videoWidget.swf?query=id:1077033400" wmode="transparent" type="application/x-shockwave-flash" width="425" height="110"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><formats>win, flash</formats></Video><Video><id>745728767</id><title>'Top Gun' For The iPhone</title><sponsored>0</sponsored><videoUrl>http://xml.truveo.com/rd?i=753365716&a=8466e666a2b70e9599b8d92d6c238d70&p=10&q=iphone&vl=1600467146%203931880598%202013553331%201573568154%201055745171%202560650780%20575714071%20208554356%201077033400%20745728767%20</videoUrl><channel>RTV6 Indianapolis</channel><channelUrl>http://www.TheIndyChannel.com</channelUrl><dateFound>Fri, 17 Jul 2009 13:20:14 -0400</dateFound><textRelevancy>397</textRelevancy><vRank>0.485093</vRank><description>The latest "Top Gun" game features plenty of "Danger Zone," a bit of Maverick &#8212; and plays on your iPhone.</description><referrerPageUrl>http://www.TheIndyChannel.com</referrerPageUrl><copyright>Copyright 2009, Internet Broadcasting Systems, Inc</copyright><category>News</category><language>English</language><dateProduced>Fri, 17 Jul 2009 12:29:29 EDT</dateProduced><thumbnailUrl>http://thumbnails.truveo.com/0010/01/94/0194FB16AF6DBD1A2704A2.jpg</thumbnailUrl><thumbnailUrlLarge>http://thumbnails.truveo.com/0010/01/94/0194FB16AF6DBD1A2704A2_Large.jpg</thumbnailUrlLarge><videoResultEmbedTag><embed src="http://www.truveo.com/truveo_videoWidget.swf?query=id:745728767" wmode="transparent" type="application/x-shockwave-flash" width="425" height="110"></embed></videoResultEmbedTag><adultFlag>0</adultFlag><formats>win</formats></Video></VideoSet></Response> | |
EOX | |
require 'rubygems' | |
require 'hpricot' | |
puts "Correct result is 10" | |
xml = Hpricot(string) | |
# Hpricot requires lowercase "video" | |
puts "[Hpricot] size = #{xml.search('//video').size}" | |
require 'nokogiri' | |
xml = Nokogiri::XML(string) | |
puts "[Nokogiri] size = #{xml.xpath('//Video').size}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment