Big Data/Analytics Zone is brought to you in partnership with:
DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Archive Flagged Items From NetNewsWire Into Yojimbo

01.17.2008
| 9925 views |
  • submit to reddit
        This lil Ruby-OSA script will allow you to import your "Flagged Items" in NetNewsWire as Web Archive Items in Yojimbo. Thus allowing you to save RSS articles for off-line viewing/storage.

#!/usr/local/bin/ruby
['rubygems', 'rbosa'].each {|lib| require lib}
nnw = OSA.app('NetNewsWire')
yojimbo = OSA.app('Yojimbo')

nnw.subscriptions.find { |s| s if s.display_name == 'Flagged Items' }.headlines.each do |article|
  unless yojimbo.web_archive_items.map { |f| f.source_url }.include?(article.url)
    archived = yojimbo.make(OSA::Yojimbo::WebArchiveItem, 
                            article.url, 
                            :name => article.title)
    # Adjust this for slower/faster bandwidth connections (or your feeling lucky, punk)
    sleep(5)
    # Uncomment below to remove the flagged items upon successfully archiving
    # if archived.name == 'untitled' && archived.source_url.empty?
    #   puts "!!! #{article.title} does not look to be imported !!!"
    # else
    #   article.delete
    # end
  end
end
    

Comments

Js Jullia replied on Thu, 2012/07/12 - 8:37am

Nice And Informative..... It Is So Nice Writing,Please Keep It Up.I Like It Very Much And Will share This Information With My Friends. Ink Cartridges for printers

Snippets Manager replied on Wed, 2007/05/16 - 6:54pm

Note: I check to make sure we're not importing double articles... you can remove the unless statement before archived= for further speediness.