{
  "attachments": [],
  "comments_archived": true,
  "date": "2003-08-23T17:57:06.000Z",
  "layout": "post",
  "title": "Scraping HTML with web services",
  "wordpress_id": 466,
  "wordpress_slug": "rss-scrape-urls",
  "wordpress_url": "http://www.decafbad.com/blog/?p=466",
  "year": "2003",
  "month": "08",
  "day": "23",
  "isDir": false,
  "slug": "rss-scrape-urls",
  "type": "entry",
  "postName": "2003-08-23-rss-scrape-urls",
  "html": "<p>After <a href=\"http://www.decafbad.com/blog/geek/rss_scrape_xsl.html\">checking out</a> <a href=\"http://www.whump.com/moreLikeThis/date/21/08/2003\">Bill Humphries’ approach</a> to scraping yesterday, I recalled the various things <a href=\"http://udell.roninhouse.com/bytecols/2001-08-15.html\">Jon Udell has written</a> about <span class=\"caps\">URL</span>-as-command-line and the various places I’ve seen the <a href=\"http://www.w3.org/2001/05/xslt\"><span class=\"caps\">W3C XSLT </span>Servlet</a> used in <span class=\"caps\">XSLT</span> tinkering.  I also remembered that there’s an <a href=\"http://cgi.w3.org/cgi-bin/tidy\"><span class=\"caps\">HTML </span>Tidy service</a> offered by <span class=\"caps\">W3C</span> as well.</p>\n\n<pre><code>&lt;p&gt;So&amp;#8230;  these are all URLs.  I figured I could pull together the site &lt;span class=\"caps\"&gt;URL&lt;/span&gt;, &lt;a href=\"http://www.whump.com/dropbox/nationrss/nation.xsl\"&gt;Bill&amp;#8217;s &lt;span class=\"caps\"&gt;XSLT&lt;/span&gt;&lt;/a&gt;, the tidy service, and the &lt;span class=\"caps\"&gt;XSLT&lt;/span&gt; service, and have a whole lot of scraping going on right in my browser or via wget or curl.  Here are the steps in how I composed the &lt;span class=\"caps\"&gt;URL&lt;/span&gt;:&lt;/p&gt;\n\n&lt;ol&gt;\n&lt;li&gt;&lt;a href=\"http://www.thenation.com\"&gt;http://www.thenation.com&lt;/a&gt;&lt;/li&gt;\n</code></pre>\n<li><a href=\"http://cgi.w3.org/cgi-bin/tidy?docAddr=http%3A%2F%2Fwww.thenation.com\">http://cgi.w3.org/cgi-bin/tidy?docAddr=http%3A%2F%2Fwww.thenation.com</a></li>\n<li><a href=\"http://www.w3.org/2000/06/webdata/xslt?xslfile=http%3A%2F%2Fwww.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&amp;xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3FdocAddr%3Dhttp%253A%252F%252Fwww.thenation.com&amp;transform=Submit\">http://www.w3.org/2000/06/webdata/xslt?\n\n</a><p><a href=\"http://www.w3.org/2000/06/webdata/xslt?xslfile=http%3A%2F%2Fwww.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&amp;xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3FdocAddr%3Dhttp%253A%252F%252Fwww.thenation.com&amp;transform=Submit\">xslfile=http%3A%2F%2F</a><a href=\"http://www.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&amp;\">www.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&amp;#38</a>;</p>\n<p>xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3F</p>\n<p>docAddr%3Dhttp%253A%252F%252F<a href=\"http://www.thenation.com&amp;transform=Submit\">www.thenation.com&amp;transform=Submit</a></p></li><p></p>\n\n\n<pre><code>&lt;p&gt;Unfortunately, this doesn&amp;#8217;t work.  In particular, step [#2](/tag/2) fails, the Tidy service reporting a failure in processing the original &lt;span class=\"caps\"&gt;HTML&lt;/span&gt;.  I imagine, had that worked, the whole process at step [#3](/tag/3) would be producing &lt;span class=\"caps\"&gt;RSS&lt;/span&gt;.  On my command line, &lt;span class=\"caps\"&gt;HTML &lt;/span&gt;Tidy works fine, so I&amp;#8217;ve been thinking of throwing together my own web interface to that program and seeing if that works.&lt;/p&gt;\n\n&lt;p&gt;If it works, this with the addition of a cache at each stage could allow for what I think is a pretty nifty, all web-based means of scraping news items from web sites.  &lt;/p&gt;\n\n    &lt;p&gt;What would really be nice for apps like this is a better way to express the URLs-within-URLs without escaping and escaping and escaping and...  Thinking some very lightweight scripting here, or some LISP-ish expressions would help.&lt;/p&gt;\n</code></pre>\n<!--more-->\n\n\n<p>shortname=rss_scrape_urls</p>\n<div id=\"comments\" class=\"comments archived-comments\"><h3>Archived Comments</h3>\n<ul class=\"comments\">\n<li class=\"comment\" id=\"comment-221086837\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://www.whump.com/moreLikeThis/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=622548e3f303e03297375ab20ddcb696&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://www.whump.com/moreLikeThis/\">Bill Humphries</a>\n</div>\n\n\n<p><a href=\"#comment-221086837\" class=\"permalink\"><time datetime=\"2003-08-24T16:08:56\">2003-08-24T16:08:56</time></a></p>\n</div>\n\n\n<div class=\"content\">Does the w3c Tidy service support the force output option? That's what I had to do with command line Tidy to get something well formed from The Nation's home page.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221086838\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://www.decafbad.com/blog\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2ac2cffd36ada8c734b90e02a1e5c1ac&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://www.decafbad.com/blog\">l.m.orchard</a>\n</div>\n\n\n<p><a href=\"#comment-221086838\" class=\"permalink\"><time datetime=\"2003-08-24T20:07:03\">2003-08-24T20:07:03</time></a></p>\n</div>\n\n\n<div class=\"content\">Unfortunately, it seems that the W3C service only offers an indentation option</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221086840\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://www.whump.com/moreLikeThis/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=622548e3f303e03297375ab20ddcb696&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://www.whump.com/moreLikeThis/\">Bill Humphries</a>\n</div>\n\n\n<p><a href=\"#comment-221086840\" class=\"permalink\"><time datetime=\"2003-08-25T02:13:11\">2003-08-25T02:13:11</time></a></p>\n</div>\n\n\n<div class=\"content\">It's tempting to take the script, and offer it as a service myself, with the force output option. However, I'd need to wrap an authorization service in front of it so it doesn't kill my bandwidth.</div>\n\n\n</li>\n</ul>\n\n\n</div>\n\n\n",
  "body": "<p>After <a href=\"http://www.decafbad.com/blog/geek/rss_scrape_xsl.html\">checking out</a> <a href=\"http://www.whump.com/moreLikeThis/date/21/08/2003\">Bill Humphries&#8217; approach</a> to scraping yesterday, I recalled the various things <a href=\"http://udell.roninhouse.com/bytecols/2001-08-15.html\">Jon Udell has written</a> about <span class=\"caps\">URL</span>-as-command-line and the various places I&#8217;ve seen the <a href=\"http://www.w3.org/2001/05/xslt\"><span class=\"caps\">W3C XSLT </span>Servlet</a> used in <span class=\"caps\">XSLT</span> tinkering.  I also remembered that there&#8217;s an <a href=\"http://cgi.w3.org/cgi-bin/tidy\"><span class=\"caps\">HTML </span>Tidy service</a> offered by <span class=\"caps\">W3C</span> as well.</p>\r\n\r\n\t<p>So&#8230;  these are all URLs.  I figured I could pull together the site <span class=\"caps\">URL</span>, <a href=\"http://www.whump.com/dropbox/nationrss/nation.xsl\">Bill&#8217;s <span class=\"caps\">XSLT</span></a>, the tidy service, and the <span class=\"caps\">XSLT</span> service, and have a whole lot of scraping going on right in my browser or via wget or curl.  Here are the steps in how I composed the <span class=\"caps\">URL</span>:</p>\r\n\r\n\t<ol>\r\n\t<li><a href=\"http://www.thenation.com\">http://www.thenation.com</a></li>\r\n<li><a href=\"http://cgi.w3.org/cgi-bin/tidy?docAddr=http%3A%2F%2Fwww.thenation.com\">http://cgi.w3.org/cgi-bin/tidy?docAddr=http%3A%2F%2Fwww.thenation.com</a></li>\r\n<li><a href=\"http://www.w3.org/2000/06/webdata/xslt?xslfile=http%3A%2F%2Fwww.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3FdocAddr%3Dhttp%253A%252F%252Fwww.thenation.com&transform=Submit\">http://www.w3.org/2000/06/webdata/xslt?<br />xslfile=http%3A%2F%2Fwww.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&#38;<br />xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3F<br />docAddr%3Dhttp%253A%252F%252Fwww.thenation.com&#38;transform=Submit</a></li>\r\n</ol>\r\n\r\n\t<p>Unfortunately, this doesn&#8217;t work.  In particular, step #2 fails, the Tidy service reporting a failure in processing the original <span class=\"caps\">HTML</span>.  I imagine, had that worked, the whole process at step #3 would be producing <span class=\"caps\">RSS</span>.  On my command line, <span class=\"caps\">HTML </span>Tidy works fine, so I&#8217;ve been thinking of throwing together my own web interface to that program and seeing if that works.</p>\r\n\r\n\t<p>If it works, this with the addition of a cache at each stage could allow for what I think is a pretty nifty, all web-based means of scraping news items from web sites.  </p>\r\n \r\n        <p>What would really be nice for apps like this is a better way to express the URLs-within-URLs without escaping and escaping and escaping and...  Thinking some very lightweight scripting here, or some LISP-ish expressions would help.</p>\r\n<!--more-->\r\nshortname=rss_scrape_urls\r\n\r\n<div id=\"comments\" class=\"comments archived-comments\">\r\n            <h3>Archived Comments</h3>\r\n            \r\n        <ul class=\"comments\">\r\n            \r\n        <li class=\"comment\" id=\"comment-221086837\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://www.whump.com/moreLikeThis/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=622548e3f303e03297375ab20ddcb696&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://www.whump.com/moreLikeThis/\">Bill Humphries</a>\r\n                </div>\r\n                <a href=\"#comment-221086837\" class=\"permalink\"><time datetime=\"2003-08-24T16:08:56\">2003-08-24T16:08:56</time></a>\r\n            </div>\r\n            <div class=\"content\">Does the w3c Tidy service support the force output option? That's what I had to do with command line Tidy to get something well formed from The Nation's home page.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221086838\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://www.decafbad.com/blog\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2ac2cffd36ada8c734b90e02a1e5c1ac&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://www.decafbad.com/blog\">l.m.orchard</a>\r\n                </div>\r\n                <a href=\"#comment-221086838\" class=\"permalink\"><time datetime=\"2003-08-24T20:07:03\">2003-08-24T20:07:03</time></a>\r\n            </div>\r\n            <div class=\"content\">Unfortunately, it seems that the W3C service only offers an indentation option</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221086840\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://www.whump.com/moreLikeThis/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=622548e3f303e03297375ab20ddcb696&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://www.whump.com/moreLikeThis/\">Bill Humphries</a>\r\n                </div>\r\n                <a href=\"#comment-221086840\" class=\"permalink\"><time datetime=\"2003-08-25T02:13:11\">2003-08-25T02:13:11</time></a>\r\n            </div>\r\n            <div class=\"content\">It's tempting to take the script, and offer it as a service myself, with the force output option. However, I'd need to wrap an authorization service in front of it so it doesn't kill my bandwidth.</div>\r\n            \r\n        </li>\r\n    \r\n        </ul>\r\n    \r\n        </div>\r\n    ",
  "parentPath": "./content/posts/archives/2003",
  "path": "2003/08/23/rss-scrape-urls",
  "summary": "After checking out Bill Humphries’ approach to scraping yesterday, I recalled the various things Jon Udell has written about URL-as-command-line and the various places I’ve seen the W3C XSLT Servlet used in XSLT tinkering.  I also remembered that there’s an HTML Tidy service offered by W3C as well.\n\n<p>So&#8230;  these are all URLs.  I figured I could pull together the site <span class=\"caps\">URL</span>, <a href=\"http://www.whump.com/dropbox/nationrss/nation.xsl\">Bill&#8217;s <span class=\"caps\">XSLT</span></a>, the tidy service, and the <span class=\"caps\">XSLT</span> service, and have a whole lot of scraping going on right in my browser or via wget or curl.  Here are the steps in how I composed the <span class=\"caps\">URL</span>:</p>\n\n<ol>\n<li><a href=\"http://www.thenation.com\">http://www.thenation.com</a></li>\n\nhttp://cgi.w3.org/cgi-bin/tidy?docAddr=http%3A%2F%2Fwww.thenation.com\nhttp://www.w3.org/2000/06/webdata/xslt?\n\nxslfile=http%3A%2F%2Fwww.whump.com%2Fdropbox%2Fnationrss%2Fnation.xsl&#38;\nxmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3F\ndocAddr%3Dhttp%253A%252F%252Fwww.thenation.com&transform=Submit\n\n\n<p>Unfortunately, this doesn&#8217;t work.  In particular, step [#2](/tag/2) fails, the Tidy service reporting a failure in processing the original <span class=\"caps\">HTML</span>.  I imagine, had that worked, the whole process at step [#3](/tag/3) would be producing <span class=\"caps\">RSS</span>.  On my command line, <span class=\"caps\">HTML </span>Tidy works fine, so I&#8217;ve been thinking of throwing together my own web interface to that program and seeing if that works.</p>\n\n<p>If it works, this with the addition of a cache at each stage could allow for what I think is a pretty nifty, all web-based means of scraping news items from web sites.  </p>\n\n    <p>What would really be nice for apps like this is a better way to express the URLs-within-URLs without escaping and escaping and escaping and...  Thinking some very lightweight scripting here, or some LISP-ish expressions would help.</p>",
  "needsBuild": true,
  "prevPostPath": "2003/08/22/rss-scrape-xsl",
  "prevPostTitle": "Scraping HTML with curl, tidy, and XSL",
  "nextPostPath": "2003/08/23/rss-scrape-urls2",
  "nextPostTitle": "Scraping with web services: Success"
}