<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>xpath on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/xpath/</link>
    <description>Recent content in xpath on S Anand</description>
    <generator>Hugo -- 0.156.0</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 08 May 2013 09:17:03 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/xpath/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Geocoding in Excel</title>
      <link>https://www.s-anand.net/blog/geocoding-in-excel/</link>
      <pubDate>Wed, 08 May 2013 09:17:03 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/geocoding-in-excel/</guid>
      <description>&lt;p&gt;It’s easy to convert addresses into latitudes and longitudes into addresses in Excel. Here&amp;rsquo;s the &lt;a href=&#34;https://github.com/sanand0/geocode-excel&#34;&gt;Github project&lt;/a&gt; with a downloadable &lt;a href=&#34;https://github.com/sanand0/geocode-excel/raw/master/Geocode.xlsm&#34;&gt;Excel file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is via Visual Basic code for a &lt;code&gt;GoogleGeocode&lt;/code&gt; function that &lt;a href=&#34;https://developers.google.com/maps/documentation/geocoding/&#34;&gt;geocodes&lt;/a&gt; addresses.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;Function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;GoogleGeocode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;address&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;String&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;String&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;Dim&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;New&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;MSXML2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;DOMDocument&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Load&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;http://maps.googleapis.com/maps/api/geocode/&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;xml?address=&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;address&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;amp;sensor=false&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;If&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;parseError&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;ErrorCode&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;Then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;GoogleGeocode&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;parseError&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;reason&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;Else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setProperty&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;SelectionLanguage&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;XPath&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;lat&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;SelectSingleNode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;//lat&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;lng&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;SelectSingleNode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;//lng&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;GoogleGeocode&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;lat&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;,&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;lng&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;End&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;If&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;End&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;Function&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ryan&lt;/strong&gt; &lt;em&gt;8 Jun 2015 9:28 pm&lt;/em&gt;:
I find this isn&amp;rsquo;t working and says, Compile Error; User defined type not defined
xDoc As New MSXML2.DOMDocument what do I change to fix it?
Thank you&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Richie Lionell&lt;/strong&gt; &lt;em&gt;27 Jul 2016 6:40 am&lt;/em&gt;:
Ryan, Inside the VBE, Go to Tools -&amp;gt; References, then Select Microsoft XML, v6.0 . If that doesn&amp;rsquo;t work unselect that and select Microsoft XML, v3.0&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Client side scraping for contacts</title>
      <link>https://www.s-anand.net/blog/client-side-scraping-for-contacts/</link>
      <pubDate>Fri, 06 Mar 2009 17:01:56 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/client-side-scraping-for-contacts/</guid>
      <description>&lt;p&gt;By curious coincidence, just a day after my post on &lt;a href=&#34;https://www.s-anand.net/blog/client-side-scraping/&#34;&gt;client side scraping&lt;/a&gt;, I had a chance to demo this to a client. They were making a contacts database. Now, there are two big problems with managing contacts.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Getting complete information&lt;/li&gt;
&lt;li&gt;Keeping it up to date&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now, people happy to fill out information about themselves in great detail. If you look at the public profiles on &lt;a href=&#34;http://www.linkedin.com/&#34;&gt;LinkedIn&lt;/a&gt;, you’ll find enough and more details about most people.&lt;/p&gt;
&lt;p&gt;Normally, when getting contact details about someone, I search for their name on Google with a “site:linkedin.com” and look at that information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Could this be automated?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I spent a couple of hours and came up with a primitive &lt;a href=&#34;https://www.s-anand.net/blog/get-contacts.html&#34;&gt;contacts scraper&lt;/a&gt;. Click on the link, type in a name, and you should get the LinkedIn profile for that person. (&lt;strong&gt;Caveat&lt;/strong&gt;: It’s very primitive. It works only for specific URL public profiles. Try ‘Peter Peverelli’ as an example.)&lt;/p&gt;
&lt;p&gt;It uses two technologies. &lt;a href=&#34;http://code.google.com/apis/ajaxsearch/&#34;&gt;Google AJAX Search API&lt;/a&gt; and &lt;a href=&#34;http://developer.yahoo.com/yql/&#34;&gt;YQL&lt;/a&gt;. The &lt;code&gt;search()&lt;/code&gt; function searches for a phrase…&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;load&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;search&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;1&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setOnLoadCallback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;gs&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;WebSearch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#getinfo&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;show&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;phrase&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;gs&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setSearchCompleteCallback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;gs&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;results&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;gs&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;execute&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;phrase&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;… and the &lt;code&gt;linkedin()&lt;/code&gt; function takes a LinkedIn URL and extracts the relevant information from it, using XPath.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;scrape&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;url&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xpath&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getJSON&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;http://query.yahooapis.com/v1/public/yql?callback=?&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;q&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;select * from html where(url=\&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;url&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;\&amp;#34; and xpath=\&amp;#34;&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xpath&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;\&amp;#34;)&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;format&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;json&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;linkedin&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;url&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;scrape&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;url&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;//li[@class][h3]&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So if you wanted to find Peter Peverelli, it searches on Google for “&lt;a href=&#34;http://www.google.com/search?q=Peter+Peverelli+site%3Alinkedin.com&#34;&gt;Peter Peverelli site:linkedin.com&lt;/a&gt;” and picks the first result.&lt;/p&gt;
&lt;p&gt;From this result, it displays all the &lt;code&gt;&amp;lt;LI&amp;gt;&lt;/code&gt; tags which have a class and a &lt;code&gt;&amp;lt;H3&amp;gt;&lt;/code&gt; element inside them (that’s what the &lt;code&gt;//li[@class][h3]&lt;/code&gt; XPath does).&lt;/p&gt;
&lt;p&gt;The real value of this is in bulk usage. When there’s a big list of contacts, you don’t need to scan each of them for updates. They can be automatically updated — even if all you know is the person’s name, and perhaps where they worked at some point in time.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://thejeshgn.com/2009/03/09/rss-feed-aamir-khans-blog-using-yql-and-pipes/&#34;&gt;Thejesh GN » RSS Feed Aamir Khans blog using YQL and Pipes&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;9 Mar 2009 2:44 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] Blog to create a feed. I had written custom scraping code to create the feed.Today after reading Anand’s blog I parsed the blog using YQL and created the feed using Pipes. Using YQL/PIPE much easier thank [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prakash&lt;/strong&gt; &lt;em&gt;8 Mar 2009 1:50 pm&lt;/em&gt;:
Have you tried xobni add-in for outlook (incase you use that to manage contacts)?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;8 Mar 2009 4:07 pm&lt;/em&gt;:
I don&amp;rsquo;t use it myself, but have tried it — and interestingly enough, recommended it to this client.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://thejeshgn.com&#34;&gt;Thejesh GN&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;9 Mar 2009 2:46 pm&lt;/em&gt;:
After reading this post. &lt;a href=&#34;http://thejeshgn.com/2009/03/09/rss-feed-aamir-khans-blog-using-yql-and-pipes/&#34;&gt;I redid Aamir Khans blog parsing&lt;/a&gt; using YQL and Pipes.
It was very easy as YQL was available as module inside Pipes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vasanth Asokan&lt;/strong&gt; &lt;em&gt;18 Dec 2010 6:05 am&lt;/em&gt;:
Hi Anand,
The scraper demo does not seem to be working (I tried the value you suggested as well &amp;lsquo;Peter Peverelli&amp;rsquo;. Can you take a look?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;18 Dec 2010 10:42 am&lt;/em&gt;:
True, Vasanth. Honestly, scraping was only ever useful as a temporary strut until service providers opened up the data. It required too much maintenance anyway. With LinkedIn&amp;rsquo;s API, this is outdated, and I&amp;rsquo;m planning to leave it as it is. But thanks for pointing this out!&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Client side scraping</title>
      <link>https://www.s-anand.net/blog/client-side-scraping/</link>
      <pubDate>Wed, 04 Mar 2009 18:00:57 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/client-side-scraping/</guid>
      <description>&lt;p&gt;“Scraping” is extracting content from a website. It’s often used to build something on top of the existing content. For example, I’ve built a site that &lt;a href=&#34;http://250.s-anand.net/&#34;&gt;tracks movies on the IMDb 250&lt;/a&gt; by scraping content.&lt;/p&gt;
&lt;p&gt;There are libraries that simplify &lt;a href=&#34;http://en.wikipedia.org/wiki/Web_scraping&#34;&gt;scraping&lt;/a&gt; in most languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perl: &lt;a href=&#34;http://www.perl.com/pub/a/2003/01/22/mechanize.html&#34;&gt;WWW::Mechanize&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Python: &lt;a href=&#34;http://www.crummy.com/software/BeautifulSoup/&#34;&gt;BeautifulSoup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ruby: &lt;a href=&#34;http://wiki.github.com/why/hpricot&#34;&gt;HPricot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PHP: &lt;a href=&#34;http://rainbowhatseo.fallenray.com/php5/php5-screen-scraping-with-dom-and-xpath/&#34;&gt;XPath&lt;/a&gt; (built-in)&lt;/li&gt;
&lt;li&gt;Javascript: &lt;a href=&#34;http://www.jquery.com/&#34;&gt;jQuery&lt;/a&gt; on &lt;a href=&#34;http://ejohn.org/projects/bringing-the-browser-to-the-server/&#34;&gt;env.js&lt;/a&gt; on &lt;a href=&#34;http://www.mozilla.org/rhino/&#34;&gt;Rhino&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But all of these are on the server side. That is, the program scrapes from &lt;strong&gt;your machine&lt;/strong&gt;. Can you write a web page where the &lt;strong&gt;viewer’s machine&lt;/strong&gt; does the scraping?&lt;/p&gt;
&lt;p&gt;Let’s take an example. I want to display &lt;a href=&#34;http://www.amazon.com/gp/bestsellers/books/&#34;&gt;Amazon&amp;rsquo;s bestsellers&lt;/a&gt; that cost less than $10. I could write a program that scrapes the site and get that information. But since the list updates hourly, I’ll have to run it every hour.&lt;/p&gt;
&lt;p&gt;That may not be so bad. But consider Twitter. I want to display the latest iPhone tweets from &lt;code&gt;http://search.twitter.com/search.atom?q=iPhone&lt;/code&gt;, but the results change so fast that your server can’t keep up.&lt;/p&gt;
&lt;p&gt;Nor do you want it to. Ideally, your scraper should just be Javascript on your web page. Any time someone visits, their machine does the scraping. The bandwidth is theirs, and you avoid the &lt;a href=&#34;http://www.codinghorror.com/blog/archives/000044.html&#34;&gt;popularity tax&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is quite easily done using &lt;a href=&#34;http://developer.yahoo.com/yql/&#34;&gt;Yahoo Query Language&lt;/a&gt;. YQL converts the web into a database. All web pages are in a table called &lt;code&gt;html&lt;/code&gt;, which has 2 fields: &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;xpath&lt;/code&gt;. You can get IBM’s home page using:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Try it at &lt;a href=&#34;http://developer.yahoo.com/yql/console/&#34;&gt;Yahoo’s developer console&lt;/a&gt;. The whole page is loaded into the &lt;code&gt;query.results&lt;/code&gt; element. This can be retrieved using &lt;a href=&#34;http://en.wikipedia.org/wiki/JSONP#JSONP&#34;&gt;JSONP&lt;/a&gt;. Assuming you have jQuery, try the following on &lt;a href=&#34;http://getfirebug.com/&#34;&gt;Firebug&lt;/a&gt;. You should see the contents of IBM’s site on your page.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getJSON&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://query.yahooapis.com/v1/public/yql?callback=?&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;q&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;select * from html where url=\&amp;#34;http://www.ibm.com\&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;format&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;json&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;query&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;results&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That’s it! Now, it’s pretty easy to scrape, especially with &lt;a href=&#34;http://www.w3.org/TR/xpath&#34;&gt;XPath&lt;/a&gt;. To get the links on IBM’s page, just change the query to&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot; and xpath=&amp;quot;//a&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Or to get all external links from IBM&amp;rsquo;s site:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot; and xpath=&amp;quot;//a[not(contains(@href,&#39;ibm.com&#39;))][contains(@href,&#39;http&#39;)]&amp;quot;&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now you can display this on your own site, using &lt;a href=&#34;http://www.jquery.com/&#34;&gt;jQuery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This leads to interesting possibilities, such as &lt;a href=&#34;http://ajaxian.com/archives/map-reduce-in-the-browser&#34;&gt;Map-Reduce in the browser&lt;/a&gt;. Here’s one example. Each movie on the IMDb (e.g. &lt;a href=&#34;http://www.imdb.com/title/tt0468569/&#34;&gt;The Dark Knight&lt;/a&gt;) comes with a list of recommendations (like &lt;a href=&#34;http://www.imdb.com/title/tt0468569/recommendations&#34;&gt;this&lt;/a&gt;). I want to build a repository of recommendations based on the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt;. So here’s the algorithm. First, I’ll get the IMDb Top 250 using:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.imdb.com/chart/top&amp;quot; and xpath=&amp;quot;//tr//tr//tr//td[3]//a&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then I’ll get a random movie’s recommendations like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.imdb.com/title/tt0468569/recommendations&amp;quot; and xpath=&amp;quot;//td/font//a[contains(@href,&#39;/title/&#39;)]&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then I’ll send off the results to my aggregator.&lt;/p&gt;
&lt;p&gt;Check out the full code at &lt;a href=&#34;http://250.s-anand.net/build-reco.js&#34;&gt;http://250.s-anand.net/build-reco.js&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In fact, if you visited &lt;a href=&#34;http://250.s-anand.net/&#34;&gt;my IMDb Top 250 tracker&lt;/a&gt;, &lt;strong&gt;you already ran this code&lt;/strong&gt;. You didn’t know it, but you just shared a bit of your bandwidth and computation power with me. (Thank you.)&lt;/p&gt;
&lt;p&gt;And, if you think a little further, here another way of monetising content: by borrowing a bit of the user’s computation power to build complex tasks. There already are &lt;a href=&#34;http://www.pluraprocessing.com/&#34;&gt;startups&lt;/a&gt; built around this concept.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://aravindavk.in&#34;&gt;Aravinda&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;4 Mar 2009 7:20 pm&lt;/em&gt;:
Great!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sriram&lt;/strong&gt; &lt;em&gt;4 Mar 2009 10:51 pm&lt;/em&gt;:
Thank u anand. Nice Information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rishi&lt;/strong&gt; &lt;em&gt;5 Mar 2009 8:19 am&lt;/em&gt;:
Awesome&amp;hellip; This is the future&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://taeyoungchoon.wordpress.com/2009/03/26/grep-imdb-part-2/&#34;&gt;grep imdb part 2 ? « taeyoungchoon&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;26 Mar 2009 1:16 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] &lt;a href=&#34;http://www.s-anand.net/blog/client-side-scraping/&#34;&gt;http://www.s-anand.net/blog/client-side-scraping/&lt;/a&gt; [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Khair&lt;/strong&gt; &lt;em&gt;26 May 2009 4:10 pm&lt;/em&gt;:
Many thanks for your efforts in simplifying the &amp;lsquo;scraping&amp;rsquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.venkatsworld.com&#34;&gt;Venkat&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;16 Nov 2010 1:40 pm&lt;/em&gt;:
Hey Anand,
Thanks. This post is really useful. I have managed to scrape Amazon wishlist using this technique (&lt;a href=&#34;http://www.venkatsworld.com/WIP/JSON&#34;&gt;http://www.venkatsworld.com/WIP/JSON&lt;/a&gt;_amazon.html) However YQL seems to be taking some time to respond. I am not sure if you experienced this.I did a similar exercise with Picasa JSON feed and a Jquery plug-in for image scrolling. It works well there too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://news.ycombinator.com/item?id=4066478&#34;&gt;Zheka&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;17 Jun 2012 8:35 pm&lt;/em&gt;:
Interesting article! There is another powerful scraping technology available that offers Javascript, jQuery, CSS, and XPath instead of XPath-only. It&amp;rsquo;s called Bobik (&lt;a href=&#34;http://usebobik.com&#34;&gt;http://usebobik.com&lt;/a&gt;). The is a cool example of scraping restaurant menus using Bobik at &lt;a href=&#34;http://news.ycombinator.com/item?id=4066478&#34;&gt;http://news.ycombinator.com/item?id=4066478&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LAvesh&lt;/strong&gt; &lt;em&gt;12 Mar 2013 11:19 pm&lt;/em&gt;:
Hey Anand,
Great Article. Just one query though in the client side implementation its the client IP that will be hitting the website (in your case &lt;a href=&#34;https://www.ibm.com&#34;&gt;www.ibm.com&lt;/a&gt;)? or it will use yahoo SQL server IP to hit.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>JPath - XPath for Javascript</title>
      <link>https://www.s-anand.net/blog/jpath-xpath-for-javascript/</link>
      <pubDate>Thu, 29 May 2008 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/jpath-xpath-for-javascript/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.w3.org/TR/xpath&#34;&gt;XPath&lt;/a&gt; is a neat way of navigating deep XML structures. It&#39;s like using a directory structure. &lt;code&gt;/table//td&lt;/code&gt; gets all the TDs somewhere below TABLE.&lt;/p&gt;
&lt;p&gt;Usually, you don&#39;t need this sort of a thing for data structures, particularly in JavaScript. Something like &lt;code&gt;table.td&lt;/code&gt; would already work. But sometimes, it does help to have something like XPath even for data structures, so I built a simple XPath-like processor for Javascript called &lt;a href=&#34;http://js-tables.googlecode.com/svn/trunk/jpath.js&#34;&gt;JPath&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here are some examples of how it would work:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;para&#34;)                      &lt;/td&gt;&lt;td&gt;returns context.para                                       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;*&#34;)                         &lt;/td&gt;&lt;td&gt;returns all values of context (for both arrays and objects)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;para[0]&#34;)                   &lt;/td&gt;&lt;td&gt;returns context.para[0]                                    &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;para[last()]&#34;)              &lt;/td&gt;&lt;td&gt;returns context.para[context.para.length]                  &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;*/para&#34;)                    &lt;/td&gt;&lt;td&gt;returns context[&lt;i&gt;all children&lt;/i&gt;].para                  &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;/doc/chapter[5]/section[2]&#34;)&lt;/td&gt;&lt;td&gt;returns context.doc.chapter[5].section[2]                  &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;chapter//para&#34;)             &lt;/td&gt;&lt;td&gt;returns all para elements inside context.chapter           &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;//para&#34;)                    &lt;/td&gt;&lt;td&gt;returns all para elements inside context                   &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;//olist/item&#34;)              &lt;/td&gt;&lt;td&gt;returns all olist.item elements inside context             &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;.&#34;)                         &lt;/td&gt;&lt;td&gt;returns the context                                        &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;.//para&#34;)                   &lt;/td&gt;&lt;td&gt;same as //para                                             &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;jpath(context, &#34;//para/..&#34;)                 &lt;/td&gt;&lt;td&gt;returns the parent of all para elements inside context     &lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Some caveats:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This is an implementation of the abbreviated syntax of XPath. You can&#39;t use axis::nodetest&lt;/li&gt;
&lt;li&gt;No functions are supported other than last()&lt;/li&gt;
&lt;li&gt;Only node name tests are allowed, no nodetype tests. So you can&#39;t do text() and node()&lt;/li&gt;
&lt;li&gt;Indices are zero-based, not 1-based&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are a couple of reasons why this sort of thing is useful.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Extracting attributes deep down&lt;/b&gt;. Suppose you had an array of arrays, and you wanted the first element of each array.&lt;br /&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-column-selection_2533734151_o-gif.webp&#34; title=&#34;First elements of an array of arrays&#34;&gt;&lt;img src=&#34;https://www.s-anand.net/blog/assets/flickr-column-selection_2533734151_o-gif.webp&#34; width=&#34;160&#34; height=&#34;128&#34; alt=&#34;Column Selection&#34;&gt;&lt;/a&gt; &lt;br /&gt;You could do this the long way:
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;list&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[],&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;length&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;list&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;push&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;][&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;... or the short way:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;map&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;v&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;v&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But the best would be something like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;jpath&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;//1&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Ragged data structures&lt;/b&gt;. Take for example the results from &lt;a href=&#34;http://code.google.com/apis/ajaxfeeds/documentation/&#34;&gt;Google&#39;s AJAX feed API&lt;/a&gt;.
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;&amp;#34;responseData&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; &lt;span class=&#34;nt&#34;&gt;&amp;#34;feed&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Digg&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://digg.com/&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;author&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;description&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Digg&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;rss20&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;#34;entries&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;The Pirate Bay Moves Servers to Egypt Due to Copyright Laws&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://digg.com/tech_news/The_Pirate_Bay_Moves_Servers_to_Egypt_Due_to_Copyright_Laws&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;author&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;publishedDate&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Mon, 31 Mar 2008 23:13:33 -0700&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;contentSnippet&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Due to the new copyright legislation that are going ...&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;content&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Due to the new copyright legislation that are going to take...&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;categories&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Millions Dead/Dying in Recent Mass-Rick-Rolling by YouTube.&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://digg.com/comedy/Millions_Dead_Dying_in_Recent_Mass_Rick_Rolling_by_YouTube&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;author&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;publishedDate&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Mon, 31 Mar 2008 22:53:30 -0700&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;contentSnippet&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Click on any \u0022Featured Videos\u0022. When will the insanity stop?&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;content&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Click on any \u0022Featured Videos\u0022. When will the insanity stop?&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;&amp;#34;categories&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   &lt;span class=&#34;err&#34;&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nt&#34;&gt;&amp;#34;responseDetails&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nt&#34;&gt;&amp;#34;responseStatus&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;200&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you wanted all the &lt;code&gt;title&lt;/code&gt; entries, &lt;i&gt;including the feed title&lt;/i&gt;, the choice is between:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;titles&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;feed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;title&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;l&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;feed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;entries&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;length&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;l&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;titles&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;push&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;feed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;entries&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;].&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;title&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;... versus...&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;titles&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;jpath&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;//title&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If, further, you wanted the list of all categories at one shot, you could use:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;jpath&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;//categories/*&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Will&lt;/strong&gt; &lt;em&gt;7 Mar 2010 1:15 pm&lt;/em&gt;:
See also: &lt;a href=&#34;http://www.w3schools.com/xpath/tryit.asp?filename=try&#34;&gt;http://www.w3schools.com/xpath/tryit.asp?filename=try&lt;/a&gt;_xpath_select_pricenodes_text&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Lazy bargain hunting</title>
      <link>https://www.s-anand.net/blog/lazy-bargain-hunting/</link>
      <pubDate>Fri, 04 Jan 2008 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/lazy-bargain-hunting/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m thinking of buying a &lt;a href=&#34;http://images.google.com/images?q=digital+keyboard&#34;&gt;digital keyboard&lt;/a&gt; with &lt;a href=&#34;http://www.catherineduc.com/linkkeyboards.htm&#34;&gt;touch sensitive keys and MIDI support&lt;/a&gt;. (The one other thing that I thought off &amp;ndash; a &lt;a href=&#34;http://commons.wikimedia.org/wiki/Image:Pitch_Bend_Up.jpg&#34;&gt;pitch bend&lt;/a&gt; &amp;ndash; puts the keyboards out of my budget.)&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;d like a good deal. (Who doesn&amp;rsquo;t?) But I don&amp;rsquo;t like to spend time searching for one. (Who does?)&lt;/p&gt;
&lt;p&gt;So here&amp;rsquo;s the plan.&lt;/p&gt;
&lt;p&gt;Firstly, I&amp;rsquo;ll &lt;strong&gt;restrict my search to &lt;a href=&#34;http://www.amazon.co.uk/&#34;&gt;Amazon.co.uk&lt;/a&gt;&lt;/strong&gt;. For electronics items, I haven&amp;rsquo;t found anyone consistently cheaper. &lt;a href=&#34;http://direct.tesco.com/&#34;&gt;Tesco&lt;/a&gt; has some pretty low prices, but not the range. &lt;a href=&#34;http://www.ebuyer.com/&#34;&gt;eBuyer&lt;/a&gt; is pretty good, but not often enough. &lt;a href=&#34;http://www.google.co.uk/products&#34;&gt;Google Products&lt;/a&gt; is the only other one that gets me consistent lower prices, but I&amp;rsquo;ve had my credit card identity stolen once before while shopping online, so I&amp;rsquo;d rather not pick any random seller listed on Google.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Amazon has a &lt;a href=&#34;http://www.enjoydeals.com/amazon_uk.php&#34;&gt;secret discount&lt;/a&gt;&lt;/strong&gt;. You can search for &lt;a href=&#34;http://www.amazon.co.uk/gp/search/?node=560798&#34;&gt;electronics&lt;/a&gt; items with &lt;a href=&#34;http://www.amazon.co.uk/gp/search/?node=560798&amp;amp;pct-off=30-&amp;amp;sort=salesrank&#34;&gt;30% off or more&lt;/a&gt;. And then you can narrow it down to &lt;a href=&#34;http://www.amazon.co.uk/s/ref=sr_nr_n_4?ie=UTF8&amp;amp;rs=10305241&amp;amp;sort=salesrank&amp;amp;rh=n%3A560798%2Cp%5F8%3A30-%2Cn%3A560858%2Cn%3A10305241%2Cn%3A310201011&#34;&gt;Sound &amp;amp; Vision &amp;gt; Musical Instruments &amp;gt; MIDI Keyboards&lt;/a&gt;. Further cap a &lt;a href=&#34;http://www.amazon.co.uk/s/ref=sr_nr_p_36_2?ie=UTF8&amp;amp;rs=310201011&amp;amp;sort=salesrank&amp;amp;rh=n%3A560798%2Cp%5F8%3A30-%2Cn%3A560858%2Cn%3A10305241%2Cn%3A310201011%2Cp%5F36%3A10000-20000&#34;&gt;100 - 200 GBP&lt;/a&gt; restriction. That leaves us with one product:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-midi-keyboard-on-amazon_2166283290_o-png.webp&#34; title=&#34;MIDI keyboard on Amazon&#34;&gt;&lt;img alt=&#34;MIDI keyboard on Amazon&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-midi-keyboard-on-amazon_2166283290_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;While that matches my criteria, I&amp;rsquo;m in no hurry and can wait for more offers to come up. But I don&amp;rsquo;t want to keep checking this page every day. So, &lt;a href=&#34;https://www.s-anand.net/blog/advanced-google-reader/&#34;&gt;&lt;strong&gt;RSS to the rescue&lt;/strong&gt;&lt;/a&gt;. You probably think I can&amp;rsquo;t get enough of RSS feeds. And you&amp;rsquo;d be right. The thing is, as an attention mechanism, it is incredibly powerful, and I never cease to be amazed that the things it lets me do.&lt;/p&gt;
&lt;p&gt;Using my &lt;a href=&#34;https://addons.mozilla.org/en-US/firefox/addon/1095&#34;&gt;XPath checker&lt;/a&gt; and a bit of trial and error, I figured all product links link to &amp;ldquo;amazon.co.uk/dp/&amp;hellip;&amp;rdquo; with a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; inside. So this XPath gets all the links:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-xpath&#34; data-lang=&#34;xpath&#34;&gt;//a[contains(@href,&amp;#39;/dp/&amp;#39;)][span]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And I made an RSS feed out of that using my &lt;a href=&#34;https://www.s-anand.net/blog/scraping-rss-feeds-using-xpath/&#34;&gt;XPath server&lt;/a&gt; and &lt;a href=&#34;http://www.google.com/reader/shared/user/16836184467750910501/label/blog:%20keyboard%20rss%20feed&#34;&gt;subscribed to it on Google Reader&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Combining a bunch of such searches, I have a shopping folder on Google Reader has all the items I&amp;rsquo;m searching for. Now &lt;strong&gt;that&amp;rsquo;s&lt;/strong&gt; lazy bargain hunting.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Which is all very fine. But given that I&amp;rsquo;m buying a car in a hurry right now, and I&amp;rsquo;m not doing any bargain hunting, it&amp;rsquo;s a classic case of being penny-wise and pound-foolish. Sigh&amp;hellip;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Oracle&lt;/strong&gt; &lt;em&gt;4 Jan 2008 12:00 pm&lt;/em&gt;:
Alternate way is to set-up a google alert for the specific item in the chosen sites. Do you see any disadvantages with that?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rajesh&lt;/strong&gt; &lt;em&gt;11 Nov 2008 7:58 am&lt;/em&gt;:
Never had someone&amp;rsquo;s personal website kept me so drawn in. You are smart and very articulate (u probably know this already) and it shows in each intersting and very often informative article you write. you can even try writing columns in magazines, websites or papers. i&amp;rsquo;ve learnt a lot from your site already and haven&amp;rsquo;t finished reading them all. i also see you play the keyboard and maybe interested in midis. i&amp;rsquo;ve sequenced some midis. u can can find them at&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://rajesh.annamalaisamy.googlepages.com/rajeshmidis&#34;&gt;http://rajesh.annamalaisamy.googlepages.com/rajeshmidis&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;if u&amp;rsquo;re interested. The best tamil song midis in my opinion are done by kishmu. His midi works can be found at&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.geocities.com/kishmu/&#34;&gt;www.geocities.com/kishmu/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Eagerly anticipating your next article.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Rajesh&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Web lookup using Google Spreadsheets</title>
      <link>https://www.s-anand.net/blog/web-lookup-using-google-spreadsheets/</link>
      <pubDate>Mon, 31 Dec 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/web-lookup-using-google-spreadsheets/</guid>
      <description>&lt;p&gt;I&amp;rsquo;d written earlier about &lt;a href=&#34;https://www.s-anand.net/blog/web-lookup-using-excel/&#34;&gt;Web lookup in Excel&lt;/a&gt;. I showed &lt;a href=&#34;https://www.s-anand.net/blog/rss-feeds-in-excel/&#34;&gt;an example&lt;/a&gt; how you could create a movie wishlist that showed the links to the torrents from &lt;a href=&#34;http://www.mininova.org/&#34;&gt;Mininova&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can do that even easier on &lt;a href=&#34;http://spreadsheets.google.com/&#34;&gt;Google Spreadsheets&lt;/a&gt;. It has 4 functions that let you &lt;a href=&#34;http://documents.google.com/support/spreadsheets/bin/answer.py?hl=en&amp;amp;answer=75507&#34;&gt;import external data&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;=importData&lt;/strong&gt;(&amp;ldquo;URL of CSV or TSV file&amp;rdquo;).&lt;br&gt;
Imports a comma-separated or tab-separated file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;=importFeed&lt;/strong&gt;(URL).vLets you import any Atom or RSS feed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;=importHtml&lt;/strong&gt;(URL, &amp;ldquo;list&amp;rdquo; | &amp;ldquo;table&amp;rdquo;, index).&lt;br&gt;
Imports a table or list from any web page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;=importXML&lt;/strong&gt;(&amp;ldquo;URL&amp;rdquo;,&amp;ldquo;query&amp;rdquo;).&lt;br&gt;
Imports anything from any web page using &lt;a href=&#34;http://www.w3.org/TR/1999/REC-xpath-19991116&#34;&gt;XPath&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Firstly, you can see straight off why it&amp;rsquo;s easy to view RSS feeds in Google Spreadsheets. Just use the &lt;code&gt;importFeed&lt;/code&gt; function straight away. So, for example, if I wanted to track all &lt;a href=&#34;http://base.google.com/base/s2?q=ipod&amp;amp;btnG=Search+Base&amp;amp;authorid=81898&amp;amp;a_n0=products&amp;amp;a_y0=9&amp;amp;nd=1&amp;amp;showrefine=1&amp;amp;hl=en&amp;amp;gl=US#ajax%3Fa_n0%3Dproducts%26a_y0%3D9%26start%3D0%26q%3Dipod%26scoring%3D%26%26a_n1%3Dproduct%2Btype%26a_y1%3D1%26a_o1%3D0%26a_v1%3Dmp3%2Bplayers%26a_n2%3Dprice%26a_y2%3D8%26a_o2%3D1%26a_t2%3D200%26a_u2%3Dusd%26a_n3%3Dbrand%26a_y3%3D1%26a_o3%3D5%26a_n4%3Dcondition%26a_y4%3D1%26a_o4%3D6%26a_n5%3Dgigabytes%26a_y5%3D2%26a_o5%3D0%26a_v5%3D8%26a_n6%3Dmpn%26a_y6%3D1%26a_o6%3D5%26%26%26%26lnk%3Drefine-2%26nd%3D1%26hl%3Den%26gl%3DUS%26view%3DList&#34;&gt;8GB iPods on Google Base&lt;/a&gt;, I can import its &lt;a href=&#34;http://base.google.com/base/search?a_n0=products&amp;amp;a_y0=9&amp;amp;start=0&amp;amp;q=ipod&amp;amp;scoring=&amp;amp;&amp;amp;a_n1=product+type&amp;amp;a_y1=1&amp;amp;a_o1=0&amp;amp;a_v1=mp3+players&amp;amp;a_n2=price&amp;amp;a_y2=8&amp;amp;a_o2=1&amp;amp;a_t2=200&amp;amp;a_u2=usd&amp;amp;a_n3=brand&amp;amp;a_y3=1&amp;amp;a_o3=5&amp;amp;a_n4=condition&amp;amp;a_y4=1&amp;amp;a_o4=6&amp;amp;a_n5=gigabytes&amp;amp;a_y5=2&amp;amp;a_o5=0&amp;amp;a_v5=8&amp;amp;a_n6=mpn&amp;amp;a_y6=1&amp;amp;a_o6=5&amp;amp;&amp;amp;&amp;amp;&amp;amp;lnk=refine-2&amp;amp;nd=1&amp;amp;hl=en&amp;amp;gl=US&amp;amp;view=List&amp;amp;output=rss&amp;amp;ie=utf8&amp;amp;oe=utf8&#34;&gt;feed&lt;/a&gt; in Google Spreadsheets.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets-importfeed_2152015648_o-png.webp&#34; title=&#34;Google Spreadsheets ImportFeed&#34;&gt;&lt;img alt=&#34;Google Spreadsheets ImportFeed&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets-importfeed_2152015648_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This automatically creates a list of the latest 8GB iPods.&lt;/p&gt;
&lt;p&gt;Incidentally, the &amp;ldquo;Price&amp;rdquo; column doesn&amp;rsquo;t appear automatically. It&amp;rsquo;s a part of the description. But it&amp;rsquo;s quite easy to get the price using the standard Excel functions. Let&amp;rsquo;s say the description is in cell C1. &lt;code&gt;=MID(C1, FIND(&amp;quot;Price&amp;quot;, C1), 20)&lt;/code&gt; gets you the 20 characters starting from &amp;ldquo;Price&amp;rdquo;. Then you can sort and play around as usual.&lt;/p&gt;
&lt;p&gt;The other powerful thing about Google Spreadsheets is the &lt;a href=&#34;http://documents.google.com/support/spreadsheets/bin/answer.py?hl=en&amp;amp;answer=71291&#34;&gt;CONTINUE function&lt;/a&gt;. The &lt;code&gt;importFeed&lt;/code&gt; function creates a multi-dimensional array. You can extract any cell from the array (for example, row 3, column 2 from cell C1) using &lt;code&gt;CONTINUE(C1, 3, 2)&lt;/code&gt;. So you can just pick up the title and description, or only alternate rows, or put all rows and columns in a single column &amp;ndash; whatever.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets-continue_2151240703_o-png.webp&#34; title=&#34;Google Spreadsheets CONTINUE&#34;&gt;&lt;img alt=&#34;Google Spreadsheets CONTINUE&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets-continue_2151240703_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The most versatile of the import functions is the &lt;code&gt;importXML&lt;/code&gt; function. It lets you import any URL (including an RSS feed), filtering only the &lt;a href=&#34;http://www.w3.org/TR/1999/REC-xpath-19991116&#34;&gt;XPath&lt;/a&gt; you need. As I mentioned earlier, you can &lt;a href=&#34;https://www.s-anand.net/blog/scraping-rss-feeds-using-xpath/&#34;&gt;scrape any site using XPath&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;=importXML(&amp;quot;http://www.imdb.com/chart/top&amp;quot;, &amp;quot;//table//table//table//a&amp;quot;)&lt;/code&gt; imports the top 250 movies from the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt;. the second parameter says, get all links (a) inside a table inside a table inside a table. This populates a list with the entire Top 250.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets---importxml_2152056088_o-png.webp&#34; title=&#34;Google Spreadsheets - ImportXML&#34;&gt;&lt;img alt=&#34;Google Spreadsheets - ImportXML&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets---importxml_2152056088_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, against each of these, we could get a feed of Mininova&amp;rsquo;s torrents. Mininova&amp;rsquo;s RSS URL is &lt;code&gt;http://www.mininova.org/rss/search_string&lt;/code&gt;. So, in cell B1, I can get a torrent for the cell A1 (The Godfather) using the &lt;code&gt;importFeed&lt;/code&gt; function. (Note: you need to replace spaces with a + symbol. These functions don&amp;rsquo;t like invalid URLs.).&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets---import-mininova-feed_2151264663_o-png.webp&#34; title=&#34;Google Spreadsheets - Import Mininova Feed&#34;&gt;&lt;img alt=&#34;Google Spreadsheets - Import Mininova Feed&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-google-spreadsheets---import-mininova-feed_2151264663_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Just copy this formula down to get a torrent against each of the IMDb Top 250 movies!&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://spreadsheets.google.com/ccc?key=poz40xh4E1uen8Pedf01NEQ&amp;amp;hl=en&#34;&gt;Check out the sheet I&amp;rsquo;ve created&lt;/a&gt;. (You need a Google account to see the sheet. If you don&amp;rsquo;t want have one, you can &lt;a href=&#34;http://spreadsheets.google.com/pub?key=poz40xh4E1uen8Pedf01NEQ&#34;&gt;view the sheet&lt;/a&gt;.)&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Now, that&amp;rsquo;s still not the best of it. You can extract this file as an RSS feed! Google lets you publish your sheets as HTML, PDF, Text, XLS, etc. and RSS and Atom are included as well. Here&amp;rsquo;s the &lt;a href=&#34;http://spreadsheets.google.com/feeds/list/o16705544397998276259.1246737882357952679/od7/public/basic?alt=rss&#34;&gt;RSS feed for my sheet above&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Think about it. We now have an application that sucks in data from a web page, does a web-based vlookup on another service, and returns the results as an RSS feed!&lt;/p&gt;
&lt;p&gt;There are only two catches to this. The first is that Google has restricted us to 50 import functions per sheet. So you can&amp;rsquo;t really have the IMDb Top 250 populated here &amp;ndash; only the top 49. The second is that the spreadsheet updates only when you open it again. So it&amp;rsquo;s not really a dynamically updating feed. You need to open the spreadsheet to refresh it.&lt;/p&gt;
&lt;p&gt;But if you really wanted these things, there&amp;rsquo;s always &lt;a href=&#34;http://pipes.yahoo.com&#34;&gt;Yahoo! Pipes&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Gregory Dillon&lt;/strong&gt; &lt;em&gt;31 Dec 2007 12:00 pm&lt;/em&gt;:
Hey, thanks. Your page was the most helpful of all. In the example with the movie names, how did you figure out that it was a table x3. or table within table within table.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;30 Mar 2010 9:04 pm&lt;/em&gt;:
Looks like the IMDb top 250 page format has changed. =importXML(&amp;ldquo;&lt;a href=&#34;http://www.imdb.com/chart/top%22&#34;&gt;http://www.imdb.com/chart/top&amp;quot;&lt;/a&gt;, &amp;ldquo;//div[@id=&amp;ldquo;&amp;ldquo;main&amp;rdquo;&amp;rdquo;]//table//font/a&amp;rdquo;) seems to work now.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sintl&lt;/strong&gt; &lt;em&gt;2 Jan 2011 4:24 am&lt;/em&gt;:
Hi
Is there a possibility to get selective text from webpage by using import url function.
=ImportHtml(URL; &amp;ldquo;list&amp;rdquo; | &amp;ldquo;table&amp;rdquo;; index)
I want to pull following text Updated Sunday, December 19, 2010 from a html page
Thnx&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.thebodyzoom.com&#34;&gt;Siamak&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;26 Aug 2011 11:03 pm&lt;/em&gt;:
I have an excel file with the name of about 300 businesses that I want to look up their phone numbers or websites. Any idea how I can automate this, rather than type each entry in Google?
Thanks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;akc&lt;/strong&gt; &lt;em&gt;30 Jul 2011 11:07 am&lt;/em&gt;:
Hey
Very Helpful website it is&amp;hellip;&amp;hellip;&amp;hellip;.Please help me
I wan to import data from (&lt;a href=&#34;http://dsebd.org/latest&#34;&gt;http://dsebd.org/latest&lt;/a&gt;_share_price_scroll_l.php ) . to google spreadsheet . I wan to import share price .
Now tell me which way i will use. I m failed&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Scraping RSS feeds using XPath</title>
      <link>https://www.s-anand.net/blog/scraping-rss-feeds-using-xpath/</link>
      <pubDate>Mon, 17 Dec 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/scraping-rss-feeds-using-xpath/</guid>
      <description>&lt;p&gt;If a site doesn&#39;t have an RSS feed, your simplest option is to use &lt;a href=&#34;http://www.page2rss.com/&#34;&gt;Page2Rss&lt;/a&gt;, which gives a feed of what&#39;s changed on a page.&lt;/p&gt;
&lt;p&gt;My needs, sometimes, are a bit more specific. For example, I want to track new movies on the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt;. They don&#39;t offer a feed. I don&#39;t want to track all the other junk on that page. Just the top 250.&lt;/p&gt;
&lt;p&gt;There&#39;s a standard called &lt;a href=&#34;http://www.w3.org/TR/1999/REC-xpath-19991116&#34;&gt;XPath&lt;/a&gt;. It can be used to search in an HTML document in a pretty straightforward way. Here are some examples:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;//a&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Matches all &amp;lt;a&amp;gt; links&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;//p/b&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Matches all &amp;lt;b&amp;gt; bold items in a &amp;lt;p&amp;gt; para. (the &amp;lt;b&amp;gt; must be immediately under the &amp;lt;p&amp;gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;//table//a&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Matches all links inside a table (the links need not be immediately inside the table -- anywhere inside the table works)&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;You get the idea. It&#39;s like a folder structure. / matches the a tag that&#39;s immediately below. // matches a tag that&#39;s somewhere below. You can play around with XPath using the &lt;a href=&#34;https://addons.mozilla.org/en-US/firefox/addon/1095&#34;&gt;Firefox XPath Checker&lt;/a&gt; add-on. Try it -- it&#39;s much easier to try it than to read the documentation.&lt;/p&gt;
&lt;p&gt;The following XPath matches the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt; exactly.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-xpath&#34; data-lang=&#34;xpath&#34;&gt;//tr//tr//tr//td[3]//a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(It&#39;s a link inside the 3rd column in a table row in a table row in a table row.)&lt;/p&gt;
&lt;p&gt;Now, all I need is to get something that converts that to an RSS feed. I couldn&#39;t find anything on the Web, so I wrote my own &lt;a href=&#34;https://www.s-anand.net/blog/xpath&#34;&gt;XPath server&lt;/a&gt;. The URL:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/xpath?url=http://www.imdb.com/chart/top&amp;#038;xpath=//tr//tr//tr[position()&amp;gt;1]//td[3]//a&#34;&gt;www.s-anand.net/xpath?&lt;br /&gt;url=http://www.imdb.com/chart/top&amp;#038;&lt;br /&gt;xpath=//tr//tr//tr//td[3]//a&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When I subscribe to this URL on &lt;a href=&#34;http://reader.google.com/&#34;&gt;Google Reader&lt;/a&gt;, I get to know whenever there&#39;s a new movie on the IMDb Top 250.&lt;/p&gt;
&lt;p&gt;This gives only the names of the movies, though, and I&#39;d like the links as well. The &lt;a href=&#34;https://www.s-anand.net/blog/xpath&#34;&gt;XPath server&lt;/a&gt; supports this. It accepts a root XPath, and a bunch of sub-XPaths. So you can say something like:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/xpath?url=http://www.imdb.com/chart/top&amp;#038;xpath=//tr//tr//tr[position()&amp;gt;1] title-&amp;gt;./td[3]//a link-&amp;gt;./td[3]//a/@href&#34;&gt;xpath=//tr//tr//tr title-&amp;gt;./td[3]//a link-&amp;gt;./td[3]//a/@href&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This says three things:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;//tr//tr//tr&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Pick all rows in a row in a row&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;title-&gt;./td[3]//a&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;For each row, set the title to the link text in the 3rd column&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;link-&gt;./td[3]//a&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;... and the link to the link href in the 3rd column&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;That provides a more satisfactory RSS feed -- one that I&#39;ve subscribed to, in fact. Another one that I track is a list of &lt;a href=&#34;https://www.s-anand.net/blog/xpath?url=http://www.mininova.org/cat-list/4/seeds/&amp;#038;xpath=//tr/td[2]/a[not(img)] title-&gt;. link-&gt;./@href&#34;&gt;new popular movies&lt;/a&gt; that make it to the &lt;a href=&#34;http://www.mininova.org/cat-list/4/seeds/&#34;&gt;mininova top seeded movies&lt;/a&gt; category.&lt;/p&gt;
&lt;p&gt;You can whiff up more complex examples. Give it a shot. Start simple, with something that works, and move up to what you need. Use &lt;a href=&#34;https://addons.mozilla.org/en-US/firefox/addon/1095&#34;&gt;XPath Checker&lt;/a&gt; liberally. Let me know if you have any isses. Enjoy!&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mark&lt;/strong&gt; &lt;em&gt;17 Dec 2007 12:00 pm&lt;/em&gt;:
Have you ever thought about introducing authentication to the XPath server? I would like to parse certain fields of a page that is authenticated with cookies.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rog&lt;/strong&gt; &lt;em&gt;28 Oct 2008 1:07 am&lt;/em&gt;:
Any chance you could share your xpath.php code? It seems the server is no longer available.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S Anand&lt;/strong&gt; &lt;em&gt;28 Oct 2008 1:43 am&lt;/em&gt;:
Sure Rog. I&amp;rsquo;ve mailed it to you&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;7 Mar 2009 10:35 am&lt;/em&gt;:
Post Yahoo&amp;rsquo;s introduction of &lt;a href=&#34;http://developer.yahoo.com/yql/&#34;&gt;Yahoo Query Language&lt;/a&gt;, you&amp;rsquo;re much better off using that instead of my XPath utility. I&amp;rsquo;ve covered it in this article on &lt;a href=&#34;http://www.s-anand.net/blog/client-side-scraping/&#34;&gt;client side scraping&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://technosiastic.wordpress.com/2009/04/08/scraping-your-way-to-rss-feeds/&#34;&gt;Scraping your way to RSS Feeds! « Technosiastic!&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;8 Apr 2009 10:16 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] another gem I figured which actually lets you run XPath query for scraping into a web page for RSS. It can be [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bart P&lt;/strong&gt; &lt;em&gt;3 Mar 2012 11:48 am&lt;/em&gt;:
It would be great if you could share this code, I really like to use this server, but want to remove session ids from the links (so my reader doesn&amp;rsquo;t think all links are new every time).
Is that possible? :)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ben&lt;/strong&gt; &lt;em&gt;11 Jun 2015 12:46 am&lt;/em&gt;:
Is that possible to share your xpath.php code? yahoo pipes is going to be shut down :(&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>RSS feeds in Excel</title>
      <link>https://www.s-anand.net/blog/rss-feeds-in-excel/</link>
      <pubDate>Thu, 03 May 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/rss-feeds-in-excel/</guid>
      <description>&lt;p&gt;The technique of &lt;a href=&#34;https://www.s-anand.net/blog/web-lookup-using-excel/&#34;&gt;Web lookups in Excel&lt;/a&gt; I described yesterday is very versatile. I will be running through some of the practical uses it can be put to over the next few days&lt;/p&gt;
&lt;p&gt;TO generalise things beyond just &lt;a href=&#34;https://www.s-anand.net/blog/web-lookup-using-excel/&#34;&gt;getting the Amazon price&lt;/a&gt;, I created a &lt;a href=&#34;https://www.s-anand.net/blog/user-defined-functions-in-excel/&#34;&gt;user-defined function&lt;/a&gt; called XPATH. It takes two parameters:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;URL&lt;/strong&gt; of the XML feed to read&lt;br&gt;
&lt;strong&gt;Search&lt;/strong&gt; XPath list string (separated by spaces)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This function can be used to extract information out of any XML file on the Web and get it out as a table. For example, if you wanted to watch the Top 10 movies on the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt;, and were looking for torrents, an RSS feed is available from &lt;a href=&#34;http://www.mininova.org/&#34;&gt;mininova&lt;/a&gt;. The URL &lt;a href=&#34;http://www.mininova.org/rss/movie&#34;&gt;http://www.mininova.org/rss/movie&lt;/a&gt;_name/4 gives you an RSS file matching all movies with &amp;ldquo;movie_name&amp;rdquo;. From this, we need to extract the &lt;item&gt;&lt;title&gt; and &lt;item&gt;&lt;link&gt; elements. That&amp;rsquo;s represented by &amp;ldquo;//item title link&amp;rdquo; on my search string.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-mininova-rss-feed-in-excel_482789516_o-png.webp&#34;&gt;&lt;img alt=&#34;Mininova RSS feed in Excel&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-mininova-rss-feed-in-excel_482789516_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The formula becomes &lt;code&gt;XPath2( &amp;quot;http://www.mininova.org/rss/&amp;quot;&amp;amp;A2&amp;amp;&amp;quot;/4&amp;quot;, &amp;quot;//item title link&amp;quot;)&lt;/code&gt;. The result is a 2-dimensional array returning individual items in rows, and the columns are title and link. Pulling it all together, you can get the sheet above.&lt;/p&gt;
&lt;p&gt;All of this could be done using a command-line program. Excel has one huge advantage though. It&amp;rsquo;s one of the most powerful user-interfaces. Increasingly, I&amp;rsquo;m beginning to rely on just two user interfaces for almost any task. One is the browser, and the other is Excel. With Excel, I could have a sheet that has my &lt;a href=&#34;https://www.s-anand.net/blog/wishlist-for-movies/&#34;&gt;movie wishlist&lt;/a&gt; (which changes often), and add check to see if the torrent exists. Every time I add a bunch of movies to the wishlist, it&amp;rsquo;s just a matter of copying the formula down. No need to visit a torrent search engine and typing each movie in, one by one.&lt;/p&gt;
&lt;p&gt;Another example. Someone suggests 10 movies to watch. I&amp;rsquo;d rather watch the ones with a higher IMDb rating. Again, enter the Web lookup. Type in the movie names. Use a function like this to look up the rating on IMDb, and sort by the rating.&lt;/p&gt;
&lt;p&gt;The possibilities are endless.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Isit?&lt;/strong&gt; &lt;em&gt;3 May 2007 12:00 pm&lt;/em&gt;:
Is it possible to have the feeds update cumulative so the old feeds dont get replaced in excel?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alex&lt;/strong&gt; &lt;em&gt;3 May 2007 12:00 pm&lt;/em&gt;:
Hi, I have an Excel spreadsheet with URLs of move titles on IMDB, and I would like to retrieve the movie rating. I&amp;rsquo;ve read your tutorials, and this one comes closest to what I need. However I still cannot figure out what needs to be done. It looks like you have this problem solved. If so, can you possibly share your solution with me? Thank you, Alex&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Kishan&lt;/strong&gt; &lt;em&gt;3 May 2007 12:00 pm&lt;/em&gt;:
I came here searching for the other way round. That is to publish an RSS feed of what I have in Xcel! Thanks Anyways&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;venkat&lt;/strong&gt; &lt;em&gt;15 Oct 2010 4:09 pm&lt;/em&gt;:
Anand
Can you provide the xpath function?, I need to read a rss feed into excel, and i want only some columns of data, i would appreciate if you could send the xpath function to my email id
Thanks
venkat&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.light-sensors.com&#34;&gt;Light Sensors&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;2 Dec 2010 7:08 pm&lt;/em&gt;:
movie ratings really depend on how cool the movie is, i usually rate movies depending on the story line `-;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rt&lt;/strong&gt; &lt;em&gt;27 Jun 2013 5:41 pm&lt;/em&gt;:
Hi, nice job ! can you share with me your xpath2 (i tried your other one without succes on amazon) ?Thanks, R&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Web lookup using Excel</title>
      <link>https://www.s-anand.net/blog/web-lookup-using-excel/</link>
      <pubDate>Thu, 03 May 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/web-lookup-using-excel/</guid>
      <description>&lt;p&gt;Take a look at the Excel screenshot below.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-amazon-web-prices_481952444_o-png.webp&#34;&gt;&lt;img alt=&#34;Amazon Web Prices&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-amazon-web-prices_481952444_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Yes, that&amp;rsquo;s right. I have a &lt;a href=&#34;https://www.s-anand.net/blog/user-defined-functions-in-excel/&#34;&gt;user-defined function&lt;/a&gt; called AMAZONPRICE. And it returns these cameras&amp;rsquo; &lt;strong&gt;prices directly from Amazon.com&lt;/strong&gt;. (Given the category and some keywords, it returns the price of the bestselling item on Amazon.com.)&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the code behind the function.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;Function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;AmazonPrice&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;index&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;String&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;keywords&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;String&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;String&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;Dim&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;MSXML2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;DOMDocument30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;Set&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;New&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;MSXML2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;DOMDocument30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;kr&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;If&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Load&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&amp;#34;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;amp;Version=2005-03-23&amp;amp;Operation=ItemSearch&amp;amp;SubscriptionId=03SDGQDFEB455W53SB82&amp;#34;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;amp;AssociateTag=sanand-20&amp;amp;MinimumPrice=10000&amp;amp;ResponseGroup=OfferSummary,Small&amp;#34;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;amp;Sort=salesrank&amp;amp;SearchIndex=&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;index&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;amp;Keywords=&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;keywords&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;Then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setProperty&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;SelectionLanguage&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;XPath&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setProperty&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;SelectionNamespaces&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;s2&#34;&gt;&amp;#34;xmlns:a=&amp;#34;&amp;#34;http://webservices.amazon.com/AWSECommerceService/2005-03-23&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;AmazonPrice&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;selectSingleNode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;/a:ItemSearchResponse//a:Amount&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;End&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;If&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;End&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;Function&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;p&gt;This is how it all started&amp;hellip;&lt;/p&gt;
&lt;p&gt;Flickr has a &lt;a href=&#34;http://www.flickr.com/cameras/&#34;&gt;camera finder&lt;/a&gt; that shows the most popular cameras in the Flickr community.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-flickr-camera-finder_481952446_o-png.webp&#34;&gt;&lt;img alt=&#34;flickr Camera Finder&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-flickr-camera-finder_481952446_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I &lt;a href=&#34;https://www.s-anand.net/blog/how-i-buy-gadgets/&#34;&gt;love comparing gadgets&lt;/a&gt;, I&amp;rsquo;d been doing some research around these cameras, and the &lt;a href=&#34;http://www.flickr.com/cameras/fujifilm/&#34;&gt;Fuji series&lt;/a&gt; (because I own a &lt;a href=&#34;https://www.s-anand.net/blog/my-fuji-finepix-s5600/&#34;&gt;Fuji Finepix S5600&lt;/a&gt;). I&amp;rsquo;d normally make a spreadsheet that compares these cameras on various parameters, including price.&lt;/p&gt;
&lt;p&gt;Since I believe in &lt;a href=&#34;https://www.s-anand.net/blog/excel-never-type-in-data/&#34;&gt;never typing in data&lt;/a&gt;, wondered if there was a way to get the prices in automatically&amp;hellip;&lt;/p&gt;
&lt;p&gt;Two things made this possible.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Amazon offers &lt;a href=&#34;http://www.amazon.com/gp/browse.html?node=3435361&#34;&gt;web services&lt;/a&gt; which let you get price (and almost any other) data for their products&lt;/li&gt;
&lt;li&gt;Visual Basic lets you use pretty much any ActiveX object as a control. Microsoft offers &lt;a href=&#34;http://msdn2.microsoft.com/en-us/xml/bb291077.aspx&#34;&gt;MSXML&lt;/a&gt; which you can use to load (or download) any XML file, and parse it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first task is to get the XML feed for a product you want. Amazon lets you do that through by typing in a URL. The best way to construct the URL is through &lt;a href=&#34;http://www.awszone.com/&#34;&gt;AWSZone&lt;/a&gt;. I picked the &lt;a href=&#34;http://www.awszone.com/scratchpads/aws/ecs.us/ItemSearch.aws&#34;&gt;US ItemSearch&lt;/a&gt; method, which searches for a title or keyword within a category, and returns the matches. The feed for the Canon EOS Digital Rebel XT, based on this, would be at:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;http://ecs.amazonaws.com/onca/xml?
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Service=AWSECommerceService&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Version=2005-03-23&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Operation=ItemSearch&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    SubscriptionId=0525E2PQ81DD7ZTWTK82&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    SearchIndex=Electronics&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Keywords=Canon EOS Digital Rebel XT&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Sort=salesrank&amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    ResponseGroup=Offers,Small
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(You really need to replace the Subscription ID with your own.)&lt;/p&gt;
&lt;p&gt;If you &lt;a href=&#34;http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&amp;amp;Version=2005-03-23&amp;amp;Operation=ItemSearch&amp;amp;SubscriptionId=0525E2PQ81DD7ZTWTK82&amp;amp;SearchIndex=Electronics&amp;amp;Keywords=Canon%20EOS%20Digital%20Rebel%20XT&amp;amp;Sort=salesrank&amp;amp;ResponseGroup=Offers,Small&#34;&gt;retrieved this URL&lt;/a&gt;, you have an XML file containing the details of all Canon EOS Digital Rebel XTs, sorted by sales rank.&lt;/p&gt;
&lt;p&gt;To load this in Excel, you need to create a &lt;a href=&#34;https://www.s-anand.net/blog/user-defined-functions-in-excel/&#34;&gt;UDF&lt;/a&gt; in Visual Basic. First, go to &lt;strong&gt;Tools - References and enable Microsoft XML, v3.0 or v4.0&lt;/strong&gt;. Now, to load an XML document, do this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-vb&#34; data-lang=&#34;vb&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;Dim&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;As&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MSXML2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;DOMDocument30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;Set&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;New&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MSXML2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;DOMDocument30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;async&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Load&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;url&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the load succeeds, then you can extract the information fairly easily, using &lt;a href=&#34;http://www.w3.org/TR/xpath&#34;&gt;XPath&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-vb&#34; data-lang=&#34;vb&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;setProperty&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;SelectionLanguage&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;XPath&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;setProperty&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;SelectionNamespaces&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; _
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s&#34;&gt;&amp;#34;xmlns:a=&amp;#34;&amp;#34;http://webservices.amazon.com/AWSECommerceService/2005-03-23&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first line says we&amp;rsquo;ll be searching using XPath. The second line is a &lt;a href=&#34;http://support.microsoft.com/kb/313372&#34;&gt;workaround to support default namespaces&lt;/a&gt;. (Don&amp;rsquo;t worry about it. I don&amp;rsquo;t quite get it either.)&lt;/p&gt;
&lt;p&gt;Finally, you get the price from the XML tree. In this case, it&amp;rsquo;s under ItemSearchResponse/Items/Item/OfferSummary/LowestNewPrice/Amount, and it&amp;rsquo;s in cents.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-vb&#34; data-lang=&#34;vb&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;AmazonPrice&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;xDoc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;selectSingleNode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;/a:ItemSearchResponse//a:Amount&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it! Now that this function is defined, just pass it the category and keywords, and you have the price of the first matching product. You can retrieve any other information about products as well &amp;ndash; like sales rank, weight, ratings, reviews, etc.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Here&amp;rsquo;s the &lt;a href=&#34;https://files.s-anand.net/blog/a/AmazonPrices.xls&#34;&gt;spreadsheet&lt;/a&gt; for you to play around with.&lt;/p&gt;
&lt;hr&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.amazon.com/gp/product/0764540726&#34;&gt;Excel 2003 Power Programming with VBA (Excel Power Programming With Vba&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.amazon.com/gp/product/0596003595&#34;&gt;Writing Excel Macros with VBA, 2nd Edition&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Saurabh&lt;/strong&gt; &lt;em&gt;3 May 2007 7:38 am&lt;/em&gt;:
There is a simpler way as well. Use Data-&amp;gt;Import External Data-&amp;gt;New Web Query. While this is not as powerful as the user defined function that you have created, but definitely a good starting point for lesser geeks :) I use this, for example, to have a dashboard kind of view for the status of the multiple projects that I handle at my work. We rely heavily on Microsoft Sharepoint at work, and using the Web Query option, I can easily get a snapshot of the status of various projects. Same can also fetch shareprices from various websites.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S Anand&lt;/strong&gt; &lt;em&gt;3 May 2007 8:16 am&lt;/em&gt;:
Good point, Saurabh! Web Query does make getting stuff out of HTML very easy. My function operates in a different domain, though. It can access XML, which Web Query won&amp;rsquo;t, but can&amp;rsquo;t access HTML, which Web Query does. I&amp;rsquo;m planning a few more posts on how to extend this concept&amp;hellip; that will explain what I mean.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rick sherrin&lt;/strong&gt; &lt;em&gt;3 May 2007 12:00 pm&lt;/em&gt;:
Hi, I work at a public library, in the acquisitions department. The majority of the work is manually keying in order information (that is available electronically elsewhere). I read your article about using Excel to retrieve amazon information. This is something that would be very useful to our library and would make my job easier. I have a little excel knowledge, but I have no experience with visual basic or xml, etc. So although it looks straightforward, it is still out of my reach. I would like to be able to enter a column of ISBN numbers in one column, and retrieve title, author, publisher, price, reviews, synopsis, cover image, in adjacent columns. I would appreciate your help if you would give me an example of how I could easily do this. Thanks Rick&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;dat&lt;/strong&gt; &lt;em&gt;12 Aug 2008 8:10 am&lt;/em&gt;:
useful article!
Btw, how do I retrieve other info from amazon (published date, sales rank, customer review, etc)???
thanks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S Anand&lt;/strong&gt; &lt;em&gt;13 Aug 2008 2:15 am&lt;/em&gt;:
@dat: Have a look at &lt;a href=&#34;http://www.awszone.com/&#34;&gt;http://www.awszone.com/&lt;/a&gt; for examples on other parameters.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lydia&lt;/strong&gt; &lt;em&gt;3 May 2010 12:05 am&lt;/em&gt;:
this worked until august last year when amazon changed the way the query signs into their system&amp;hellip;it now requires a signature with a timestamp in addition to the subscription ID&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bobby Baker&lt;/strong&gt; &lt;em&gt;10 Feb 2015 7:09 am&lt;/em&gt;:
Have you updated the search functions for this or do you have a new code for this?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vlad&lt;/strong&gt; &lt;em&gt;26 Aug 2015 10:00 pm&lt;/em&gt;:
Hey Annand
is it possible o get the racking status fro fedex for a column of tracking numbers?&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
