Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS importer fails to import Atom files #194

Closed
matthewmcvickar opened this issue Apr 22, 2015 · 10 comments · Fixed by #196
Closed

RSS importer fails to import Atom files #194

matthewmcvickar opened this issue Apr 22, 2015 · 10 comments · Fixed by #196

Comments

@matthewmcvickar
Copy link

I have an XML file of an Atom feed that passes validation.

I run the following:

$ jekyll import rss --source atom.xml --trace

And get the following error:

/Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/jekyll-import-0.6.0/lib/jekyll-import/importers/rss.rb:36:in `process': There doesn't appear to be any RSS items at the source (atom.xml) provided. (RuntimeError)
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/jekyll-import-0.6.0/lib/jekyll-import/importer.rb:23:in `run'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/jekyll-import-0.6.0/lib/jekyll-import.rb:30:in `block (3 levels) in add_importer_commands'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/bin/jekyll:23:in `load'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/bin/jekyll:23:in `<main>'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
    from /Users/matthewmcvickar/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
@parkr
Copy link
Member

parkr commented Apr 22, 2015

Looks like it can't create an RSS::Parser for ya:

open(source) { |s| content = s.read }
rss = ::RSS::Parser.parse(content, false)

@matthewmcvickar
Copy link
Author

@parkr Why is that happening, though? I believe the RSS parser handles Atom, not just RSS. The Atom file is passing feed validation.

@matthewmcvickar matthewmcvickar changed the title Import Failing on Valid Atom XML Import Failing to import valid Atom file Apr 22, 2015
@parkr
Copy link
Member

parkr commented Apr 22, 2015

@matthewmcvickar Can you send me your Atom file? Or can you dig into walking through this code? I don't know why it's not working because the RSS parser isn't throwing an error.

@matthewmcvickar
Copy link
Author

@parkr OK, I emailed you the file.

parkr added a commit that referenced this issue Apr 23, 2015
Otherwise it won't parse an Atom field.

Fixes #194.
@parkr
Copy link
Member

parkr commented Apr 23, 2015

@matthewmcvickar I think I have a fix. Can you try modifying your gem source for the above, or testing with a clone of this repo at the specified branch?

@matthewmcvickar
Copy link
Author

@parkr OK, I did that.

The import is starting now, but failing like #158 because the Atom file specifies no date field. Turns out that's not the only difference between Atom and RSS though—the post content in an Atom feed is stored in the content file, while in RSS it's description, and I think categories are done differently too.

So… I'm not sure what's better, then: changing the parser to look for different fields depending on the type of feed, or make a separate Atom parser?

@parkr
Copy link
Member

parkr commented Apr 23, 2015

So… I'm not sure what's better, then: changing the parser to look for different fields depending on the type of feed, or make a separate Atom parser?

I'd probably just modify this one. You should be able to determine whether it's straight-up RSS or Atom and just ask for the proper field based on the feed_type or whatever.

@parkr
Copy link
Member

parkr commented Apr 23, 2015

You could also have 3 different methods, one that handles RSS, one Atom, and one the common fields.

@matthewmcvickar
Copy link
Author

Sounds like a plan. I'll take a stab at forking this at some point.

@matthewmcvickar matthewmcvickar changed the title Failing to import valid Atom file RSS importer fails to import Atom files Apr 24, 2015
@parkr
Copy link
Member

parkr commented Apr 24, 2015

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants