Coder Social home page Coder Social logo

feed-normalizer's People

Contributors

aasmith avatar fields avatar ginkel avatar jashmenn avatar mikowitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feed-normalizer's Issues

Release new gem version

Current gem version is two years old, and there were some improvements for this time.

Maybe, it's possible to release it?

update the gem?

any chance you can update the current gem on rubygems.org? The latest gem only has changes up until January 2010.

Sorting entries

Hello,

I've aggregating two feeds and sorting them by date. Here's the code:

feeds = [
    'http://blog.woralelandia.com/tag/mi-musica/feed/',
    'http://mexicoindie.net/feed/'
]

stories = []
feeds.each do |f|
    feed = FeedNormalizer::FeedNormalizer.parse f
    stories.push( *feed.entries )
end

stories.sort_by! { |k| k[ :date_published ] }

SystemStackError: stack level too deep
from /home/renich/.gem/ruby/2.2.0/gems/feed-normalizer-1.5.2/lib/structures.rb:14:in `rescue in method_missing'

I am getting 20 stories so it shouldn't be much. Could you help me out with this and maybe add a suggestion at the readme?

NoMethodError in HtmlCleaner.clean

I ran into this while processing a twitter feed where someone had managed to inject new-line characters into the tweet.

Here's the content in question:
"AppWireless: The following stores will have the Motorola Milestone by this afternoon: \nGordon’s\n Photo, Hazard, Harlan,... http://fb.me/HmcxV9X8"

When I run clean on that, I get:
>> FeedNormalizer::HtmlCleaner.clean str
NoMethodError: undefined method traverse_element' for nil:NilClass from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:inmethod_missing'
from /usr/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/hpricot/traverse.rb:313:in /' from /usr/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/hpricot/traverse.rb:310:ineach'
from /usr/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/hpricot/traverse.rb:310:in /' from /usr/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.2/lib/html-cleaner.rb:164:inremove_tags!'
from /usr/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.2/lib/html-cleaner.rb:72:in `clean'
from (irb):82

From what I can tell, the problem stems from this regular expression in #clean:
# get all the tags in the document
# Somewhere near hpricot 0.4.92 "" starting to return all elements,
# including text nodes instead of just tagged elements.
tags = (doc/"
").inject([]) { |m,e| m << e.name if(e.respond_to?(:name) && e.name =~ /^\w+$/) ; m }.uniq

Which is matching against the full text node, and matches "Gordon's" since it is wrapped in newlines. I'm guessing the regular expression is there to try to filter out text nodes? If so, I'd suggest changing the pattern to
/\A\w+\Z/
To force the match against to whole string. Unless there's a cleaner way to filter out text nodes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.