{
  "attachments": [],
  "comments_archived": true,
  "date": "2002-10-11T18:16:20.000Z",
  "layout": "post",
  "title": "It's all about the conversation, not the referrer logs.",
  "wordpress_id": 281,
  "wordpress_slug": "ooocof",
  "wordpress_url": "http://www.decafbad.com/blog/?p=281",
  "year": "2002",
  "month": "10",
  "day": "11",
  "isDir": false,
  "slug": "ooocof",
  "type": "entry",
  "postName": "2002-10-11-ooocof",
  "html": "<p>Mark Pilgrim implements something I've been thinking about for awhile: His \"<a href=\"http://diveintomark.org/archives/2002/10/11.html#further_reading_upgrades\">Further Reading Upgrades</a>\" now harvest what appears to be the paragraph surrounding a link on a referring page.  Along with the <a href=\"http://www.decafbad.com/twiki/bin/view/Main/RSS\">RSS</a> feed of \"Further Reading\" items he's made available, he's got a nice game of follow-the-leader set up for the rest of us referrer log watchers.  Nice &amp; elegant &amp; makes me ashamed.  :)</p>\n<p><strong>Update:</strong> Mark pulls back the curtain and <a href=\"http://diveintomark.org/projects/misc/linkbackparser.py.txt\">reveals the secret</a>.  Yay!</p>\n<p>Yet another demonstration to me that <a href=\"http://www.decafbad.com/news_archives/000258.phtml#000258\">ideas are f'ing worthless</a> and the making is what matters.  Lots of things I've been <strong>thinking</strong> about doing, but never get done.  (See also: <a href=\"http://www.decafbad.com/news_archives/000305.phtml\" title=\"Blog entry [#000305](/tag/000305)\">Blog:000305</a>)  Just a few weeks ago, I managed to upgrade my referrer tracking to dig out the titles of referring pages.  And I've had an <a href=\"http://www.decafbad.com/recent_referers_rss.php\">RSS feed</a> of referrers myself for a few months now, but mine's been ugly as sin and so I've kept it to myself.  So now I'll need to think in earnest about how to do some extraction of the link-surrounding excerpt in referring pages.  Mark's referrer handling really is elegant - it even seems to know how to collapse multiple views on the same referring entry (ie. front page, archive page, individual entry page).</p>\n<p>More things to play with :)</p>\n<!--more-->\n\n\n<p>shortname=ooocof</p>\n<div id=\"comments\" class=\"comments archived-comments\"><h3>Archived Comments</h3>\n<ul class=\"comments\">\n<li class=\"comment\" id=\"comment-221084395\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2aac8a68f46151f080ddb17ee0d2454e&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://diveintomark.org/\">Mark Pilgrim</a>\n</div>\n\n\n<p><a href=\"#comment-221084395\" class=\"permalink\"><time datetime=\"2002-10-11T15:38:03\">2002-10-11T15:38:03</time></a></p>\n</div>\n\n\n<div class=\"content\">Actually, it's even better than that.  I have a list of HTML tags that act as dividers: P, BR, HR, PRE, DIV, SPAN, TD, and a few others.  I grab the text surrounding the link, demarcated by any combination of these dividers.\nThere's some other wicked cool stuff in there too, like trying to guess permalinks (and getting it right about 80% of the time, and avoiding false positives the other 20%).  First it looks for trackback data; if found, that's golden.  Otherwise it looks for the last anchor (name or id attribute in any tag, not just A) before the start of the excerpt, then looks for the first link after the excerpt that contains that anchor.  This picks up the permalink on most blogs, since they include anchor tags before the entry named the same as the permalink (either the filename or the fragment).\nA concrete example (from your own home page): this post is preceded by an anchor \"\"\"[a name=\"000306\"][/a]\"\"\", and followed by a permalink \"\"\"[a href=\"http://www.decafbad.com/news_archives/000306.phtml\"]11:16&nbsp;AM[/a]\"\"\".  See how they match?\nIt's not just A tags, though; some anchors are just an id attribute stuck on a div or h3 tag.  There are lots of variations.  Life is messy.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221084397\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://www.decafbad.com\"><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\">l.m.orchard</a>\n</div>\n\n\n<p><a href=\"#comment-221084397\" class=\"permalink\"><time datetime=\"2002-10-11T16:20:29\">2002-10-11T16:20:29</time></a></p>\n</div>\n\n\n<div class=\"content\">I just noticed the tag detection as I looked at the sample code you posted.  Much more sophisticated than I'd initially thought.  :)  I forgot that Python has a useful SGML parser - I need to play with that more.  Usually I assume that I'm stuck in trial-and-error regex-land when I want to dig out some content from a given HTML page.\nAs for the permalink detection, yes I'd found some false positives from the start, but I was amazed at how many non-obvious ones it found.  Very cool!</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221084398\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2aac8a68f46151f080ddb17ee0d2454e&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://diveintomark.org/\">Mark Pilgrim</a>\n</div>\n\n\n<p><a href=\"#comment-221084398\" class=\"permalink\"><time datetime=\"2002-10-11T19:11:47\">2002-10-11T19:11:47</time></a></p>\n</div>\n\n\n<div class=\"content\">Python's SGML parser totally rocks.  It took me ages to grok it, but when I did, it changed my world.\nMy script to pull titles, language codes, and RSS auto-discovery URLs from pages?  sgmllib.\nMy script to extract excerpts around links?  sgmllib.\nMy script to find RSS feeds even without auto-discovery links?  sgmllib.\nMy ultra-liberal RSS parser?  sgmllib.\nI wrote up a whole chapter on sgmllib ( http://diveintopython.org/dialect_divein.html ), which no one ever understands.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221084399\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://yarinareth.net/caveatlector/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=def808e6072af95b27c6d298fbb05a2b&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://yarinareth.net/caveatlector/\">Dorothea Salo</a>\n</div>\n\n\n<p><a href=\"#comment-221084399\" class=\"permalink\"><time datetime=\"2002-10-12T01:00:20\">2002-10-12T01:00:20</time></a></p>\n</div>\n\n\n<div class=\"content\">Oo. I think that was a challenge I just heard.\nOff to read the chapter now.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221084400\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://yarinareth.net/caveatlector/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=def808e6072af95b27c6d298fbb05a2b&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://yarinareth.net/caveatlector/\">Dorothea Salo</a>\n</div>\n\n\n<p><a href=\"#comment-221084400\" class=\"permalink\"><time datetime=\"2002-10-12T01:05:34\">2002-10-12T01:05:34</time></a></p>\n</div>\n\n\n<div class=\"content\">Mark, dude, you write the best damn footnotes I think I have ever seen.\nhttp://diveintopython.org/dialect_extract.html#ftn.d0e14872\nOh, and this is supposed to be hard or something? I get it, and I'm not that bright.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221084403\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2fc977e82d9f8395a0f49e6f4958bc84&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://diveintomark.org/\">Mark</a>\n</div>\n\n\n<p><a href=\"#comment-221084403\" class=\"permalink\"><time datetime=\"2002-10-13T04:54:33\">2002-10-13T04:54:33</time></a></p>\n</div>\n\n\n<div class=\"content\">He he.  I'd forgotten about that one.  As I recall, I wrote it at like 4 AM and considered taking it out upon reading it the next morning, but left it in and forgot about it.</div>\n\n\n</li>\n</ul>\n\n\n</div>\n\n\n",
  "body": "Mark Pilgrim implements something I've been thinking about for awhile: His \"<a href=\"http://diveintomark.org/archives/2002/10/11.html#further_reading_upgrades\">Further Reading Upgrades</a>\" now harvest what appears to be the paragraph surrounding a link on a referring page.  Along with the <a href=\"http://www.decafbad.com/twiki/bin/view/Main/RSS\">RSS</a> feed of \"Further Reading\" items he's made available, he's got a nice game of follow-the-leader set up for the rest of us referrer log watchers.  Nice &amp; elegant &amp; makes me ashamed.  :)\r\n<br /><br />\r\n<strong>Update:</strong> Mark pulls back the curtain and <a href=\"http://diveintomark.org/projects/misc/linkbackparser.py.txt\">reveals the secret</a>.  Yay!\r\n<br /><br />\r\nYet another demonstration to me that <a href=\"http://www.decafbad.com/news_archives/000258.phtml#000258\">ideas are f'ing worthless</a> and the making is what matters.  Lots of things I've been <strong>thinking</strong> about doing, but never get done.  (See also: <a href=\"http://www.decafbad.com/news_archives/000305.phtml\" title=\"Blog entry #000305\">Blog:000305</a>)  Just a few weeks ago, I managed to upgrade my referrer tracking to dig out the titles of referring pages.  And I've had an <a href=\"http://www.decafbad.com/recent_referers_rss.php\">RSS feed</a> of referrers myself for a few months now, but mine's been ugly as sin and so I've kept it to myself.  So now I'll need to think in earnest about how to do some extraction of the link-surrounding excerpt in referring pages.  Mark's referrer handling really is elegant - it even seems to know how to collapse multiple views on the same referring entry (ie. front page, archive page, individual entry page).\r\n<br /><br />\r\nMore things to play with :)\r\n<!--more-->\r\nshortname=ooocof\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-221084395\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2aac8a68f46151f080ddb17ee0d2454e&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://diveintomark.org/\">Mark Pilgrim</a>\r\n                </div>\r\n                <a href=\"#comment-221084395\" class=\"permalink\"><time datetime=\"2002-10-11T15:38:03\">2002-10-11T15:38:03</time></a>\r\n            </div>\r\n            <div class=\"content\">Actually, it's even better than that.  I have a list of HTML tags that act as dividers: P, BR, HR, PRE, DIV, SPAN, TD, and a few others.  I grab the text surrounding the link, demarcated by any combination of these dividers.\r\n\r\nThere's some other wicked cool stuff in there too, like trying to guess permalinks (and getting it right about 80% of the time, and avoiding false positives the other 20%).  First it looks for trackback data; if found, that's golden.  Otherwise it looks for the last anchor (name or id attribute in any tag, not just A) before the start of the excerpt, then looks for the first link after the excerpt that contains that anchor.  This picks up the permalink on most blogs, since they include anchor tags before the entry named the same as the permalink (either the filename or the fragment).\r\n\r\nA concrete example (from your own home page): this post is preceded by an anchor \"\"\"[a name=\"000306\"][/a]\"\"\", and followed by a permalink \"\"\"[a href=\"http://www.decafbad.com/news_archives/000306.phtml\"]11:16&nbsp;AM[/a]\"\"\".  See how they match?\r\n\r\nIt's not just A tags, though; some anchors are just an id attribute stuck on a div or h3 tag.  There are lots of variations.  Life is messy.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221084397\">\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\"><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\">l.m.orchard</a>\r\n                </div>\r\n                <a href=\"#comment-221084397\" class=\"permalink\"><time datetime=\"2002-10-11T16:20:29\">2002-10-11T16:20:29</time></a>\r\n            </div>\r\n            <div class=\"content\">I just noticed the tag detection as I looked at the sample code you posted.  Much more sophisticated than I'd initially thought.  :)  I forgot that Python has a useful SGML parser - I need to play with that more.  Usually I assume that I'm stuck in trial-and-error regex-land when I want to dig out some content from a given HTML page.\r\n\r\nAs for the permalink detection, yes I'd found some false positives from the start, but I was amazed at how many non-obvious ones it found.  Very cool!</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221084398\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2aac8a68f46151f080ddb17ee0d2454e&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://diveintomark.org/\">Mark Pilgrim</a>\r\n                </div>\r\n                <a href=\"#comment-221084398\" class=\"permalink\"><time datetime=\"2002-10-11T19:11:47\">2002-10-11T19:11:47</time></a>\r\n            </div>\r\n            <div class=\"content\">Python's SGML parser totally rocks.  It took me ages to grok it, but when I did, it changed my world.\r\n\r\nMy script to pull titles, language codes, and RSS auto-discovery URLs from pages?  sgmllib.\r\n\r\nMy script to extract excerpts around links?  sgmllib.\r\n\r\nMy script to find RSS feeds even without auto-discovery links?  sgmllib.\r\n\r\nMy ultra-liberal RSS parser?  sgmllib.\r\n\r\nI wrote up a whole chapter on sgmllib ( http://diveintopython.org/dialect_divein.html ), which no one ever understands.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221084399\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://yarinareth.net/caveatlector/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=def808e6072af95b27c6d298fbb05a2b&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://yarinareth.net/caveatlector/\">Dorothea Salo</a>\r\n                </div>\r\n                <a href=\"#comment-221084399\" class=\"permalink\"><time datetime=\"2002-10-12T01:00:20\">2002-10-12T01:00:20</time></a>\r\n            </div>\r\n            <div class=\"content\">Oo. I think that was a challenge I just heard.\r\n\r\nOff to read the chapter now.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221084400\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://yarinareth.net/caveatlector/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=def808e6072af95b27c6d298fbb05a2b&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://yarinareth.net/caveatlector/\">Dorothea Salo</a>\r\n                </div>\r\n                <a href=\"#comment-221084400\" class=\"permalink\"><time datetime=\"2002-10-12T01:05:34\">2002-10-12T01:05:34</time></a>\r\n            </div>\r\n            <div class=\"content\">Mark, dude, you write the best damn footnotes I think I have ever seen.\r\n\r\nhttp://diveintopython.org/dialect_extract.html#ftn.d0e14872\r\n\r\nOh, and this is supposed to be hard or something? I get it, and I'm not that bright.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221084403\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=2fc977e82d9f8395a0f49e6f4958bc84&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://diveintomark.org/\">Mark</a>\r\n                </div>\r\n                <a href=\"#comment-221084403\" class=\"permalink\"><time datetime=\"2002-10-13T04:54:33\">2002-10-13T04:54:33</time></a>\r\n            </div>\r\n            <div class=\"content\">He he.  I'd forgotten about that one.  As I recall, I wrote it at like 4 AM and considered taking it out upon reading it the next morning, but left it in and forgot about it.</div>\r\n            \r\n        </li>\r\n    \r\n        </ul>\r\n    \r\n        </div>\r\n    ",
  "parentPath": "./content/posts/archives/2002",
  "path": "2002/10/11/ooocof",
  "summary": "Mark Pilgrim implements something I've been thinking about for awhile: His \"Further Reading Upgrades\" now harvest what appears to be the paragraph surrounding a link on a referring page.  Along with the RSS feed of \"Further Reading\" items he's made available, he's got a nice game of follow-the-leader set up for the rest of us referrer log watchers.  Nice & elegant & makes me ashamed.  :)\nUpdate: Mark pulls back the curtain and reveals the secret.  Yay!\nYet another demonstration to me that ideas are f'ing worthless and the making is what matters.  Lots of things I've been thinking about doing, but never get done.  (See also: Blog:000305)  Just a few weeks ago, I managed to upgrade my referrer tracking to dig out the titles of referring pages.  And I've had an RSS feed of referrers myself for a few months now, but mine's been ugly as sin and so I've kept it to myself.  So now I'll need to think in earnest about how to do some extraction of the link-surrounding excerpt in referring pages.  Mark's referrer handling really is elegant - it even seems to know how to collapse multiple views on the same referring entry (ie. front page, archive page, individual entry page).\nMore things to play with :)",
  "needsBuild": true,
  "prevPostPath": "2002/10/10/ooocoe",
  "prevPostTitle": "A breakthrough in outline transclusion!",
  "nextPostPath": "2002/10/15/ooocog",
  "nextPostTitle": "Microsoft and Clip Art Follies"
}