rexml/httpwrite, why must you mock me?

Daniel Sheppard daniels at pronto.com.au
Wed Sep 28 03:47:56 EDT 2005


Changed it to use feed-tools and spit out an atom feed.

The attached fix_xml also contains my changes to allow the interception
of requests -- not that I need that any longer as Bob Aman showed me how
to use feed-tools to process a string rather than a URL.

Should be able to now go convertifying anything I want once I set up a
mount. The only bit that should need to change between feeds is the
xpath for finding the full content. I've changed the interface for the
DocumentConverters so that they have access to the request and response
objects (so they can discover further information and change the
contenttype on the way out). I'm thinking that the parsing of the
document and the outputting of the document should probably be handed
off to separate objects (in which case, I'd just have a
MouseHole::Converter module with a bunch of constants that are procs to
handle conversion).

But before that, I think the first step will be to add in caching of the
downloaded full-content pages. I don't think it's very nice to grab
everybody pages constantly. 

This is getting fun.

------

MouseHole.script do
	name "Slashdot Fullfeed RSS"
	namespace "http://members.iinet.net.au/~soxbox/"
	description "Converts the slashdot RSS feed to a full-content
feed"
	include_match "*"
	version "0.1"
	document_converter FeedToolsDocumentConverter.new
	rewrite do |req,res|
		document.items.each do |feed_item|
			p feed_item.link
			doc = read_xhtml_from(feed_item.link +
"&mode=nocomment")
			s = ""
			doc.each_element('//div[@class="intro"]') do |x|
				x.write(s)
			end
			feed_item.description = s
		end
	end
end 

-----Original Message-----
From: mousehole-scripters-bounces at rubyforge.org
[mailto:mousehole-scripters-bounces at rubyforge.org] On Behalf Of Grant
Hollingworth
Sent: Tuesday, 27 September 2005 10:50 PM
To: mousehole-scripters at rubyforge.org
Subject: Re: rexml/httpwrite, why must you mock me?

* Daniel Sheppard <daniels at pronto.com.au> [2005-09-27 00:40]:
> However, I don't know my way around the ruby RSS libraries enough to 
> do this yet - After parsing a feed with SimpleRss or the stdlib Rss, 
> how do you turn that data back into an RSS feed?

I've been thinking about adding feed support for the last week.  I'm
glad you actually did it.

I was going to use FeedTools.  It has a lot more dependencies than the
two you tried, but it should allow for easy rebuilding of a feed.

Once you have that abstraction in place, you could have a script that
changes links to full pages for any feed, not just Slashdot.  Users
could add the feeds they want using mouseHole's web interface.
_______________________________________________
Mousehole-scripters mailing list
Mousehole-scripters at rubyforge.org
http://rubyforge.org/mailman/listinfo/mousehole-scripters



#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_xml.rb
Type: application/octet-stream
Size: 8404 bytes
Desc: fix_xml.rb
Url : http://rubyforge.org/pipermail/mousehole-scripters/attachments/20050928/b012a150/fix_xml.obj


More information about the Mousehole-scripters mailing list