diff --git a/README b/README index 892a9d3..02a3f20 100644 --- a/README +++ b/README @@ -1,3 +1,10 @@ +As feedparser seems to have no have no new development or bugfixes in the last +8 years, I'm forking it and making my bugfixes public. + +Below, the original readme. + +------- + RSS and Atom feed parser, using expat via the luaExpat binding. Similar to the Universal Feed Parser (http://feedparser.org), but less good. diff --git a/feedparser-0.71-3.rockspec b/feedparser-0.72-1.rockspec similarity index 79% rename from feedparser-0.71-3.rockspec rename to feedparser-0.72-1.rockspec index f03f8ce..7f2805e 100644 --- a/feedparser-0.71-3.rockspec +++ b/feedparser-0.72-1.rockspec @@ -1,9 +1,9 @@ #!/bin/lua package = "feedparser" -version = "0.71-3" +version = "0.72-1" source = { - url="git://github.com/slact/lua-feedparser", - tag="0.71" + url="git+https://github.com/evandrofisico/lua-feedparser.git", + tag="0.72-1" } description = { summary = " A decent RSS and Atom XML feed parser", @@ -11,7 +11,7 @@ description = { RSS and Atom feed parser, using expat via the luaExpat binding. Similar to the Universal Feed Parser (http://feedparser.org), but less good.]], - homepage = "https://github.com/slact/lua-feedparser", + homepage = "https://github.com/evandrofisico/lua-feedparser", license = "BSD" } dependencies = { diff --git a/feedparser.lua b/feedparser.lua index 2d66b8c..45a4480 100644 --- a/feedparser.lua +++ b/feedparser.lua @@ -112,7 +112,10 @@ local function parse_entries(entries_el, format_str, base) local author_url = (el:getChild('url') or blanky):getText() if author_url and author_url ~= "" then entry.author_detail.href=resolve(author_url, rebase(el:getChild('url'), el_base)) end - elseif tag=='category' or tag=='dc:subject' then + elseif tag=='category' then + entry.category = (el:getChild('term') or el):getText() + + elseif tag=='dc:subject' then --todo elseif tag=='source' then @@ -317,7 +320,7 @@ local function parse_rss(root, base_uri) --image elseif tag=='image' or tag=='rdf:image' then feed.image={ - title=el:getChild('title'):getText(), + title=(el:getChild('title') or blanky):getText(), link=(el:getChild('link') or blanky):getText(), width=(el:getChild('width') or blanky):getText(), height=(el:getChild('height') or blanky):getText() @@ -336,6 +339,12 @@ local function parse_rss(root, base_uri) end res.entries=parse_entries(channel:getChildren('item'),'rss', channel_base) + -- a version 1.0 feed does not add the item list as children of the channel + -- entity, but the root + if res.version == "rss10" then + res.entries=parse_entries(root:getChildren('item'),'rss', channel_base) + end + return res end @@ -366,4 +375,4 @@ if _VERSION:sub(-3) < "5.3" then end -return feedparser \ No newline at end of file +return feedparser