From: Hiroshi Saito <monodie@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Trouble updating some RSS feeds with org-feed
Date: Wed, 23 Sep 2015 21:46:44 +0900 [thread overview]
Message-ID: <CAFEtL0d=qZ7VPPmPLW3ROJV3Tv6mYZB_nFbz9Ofjri9Qt-6wsQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]
Hi all,
I noticed that the org-feed could not properly handle RSS feeds which do not
contain <guid> element. The value of <guid> element is used as a key of an
association list to manage entry statuses. The keys become `nil' when a <guid>
element not found. Then no entries are added anymore after first update since a
key of new entry (`nil') is already included in the association list.
Here is an example .emacs:
----------------------------------------------------------------------
(setq org-feed-alist
'(("Hacker News"
"https://news.ycombinator.com/rss"
"~/feed.org" "Hacker News"
)))
----------------------------------------------------------------------
After running `org-feed-update-all', keys of feed status in ~/feed.org
are `nil' like this:
----------------------------------------------------------------------
:FEEDSTATUS:
((nil t "4e939ac25cb5b7c825c0894c364a220d5a98a7bf")
(nil t "2eac7fd17ae277ba6ad6fd658da663bdf2a28586")
(nil t "4939903fe5796ea1b5132209c5ab983e0558b5fd")
...
:END:
----------------------------------------------------------------------
After that, `org-feed-update-all' no longer adds new entries in above reason.
It is possible to work around this issue via `:parse_feed' option. But, I think
it would be reasonable that org-feed handles <guid>-less RSS feeds.
So, I wrote a small patch that uses a value of <link> as a key if <guid> is
missing. It's simple and not too bad since there's certain consistency to
<guid> and <link> except <link> is also optional. Another option could be using
a hash of <title> or <description> but I feel it's excessive.
--
Sincerely,
Hiroshi Saito
[-- Attachment #2: 0001-org-feed.el-Use-a-value-of-link-as-guid-if-guid-is-m.patch --]
[-- Type: application/octet-stream, Size: 1361 bytes --]
From 8ffae59ce301ba77e470bf3ff415b97aef6e4e0a Mon Sep 17 00:00:00 2001
From: Hiroshi Saito <saidie@saidie.info>
Date: Wed, 23 Sep 2015 16:58:09 +0900
Subject: [PATCH] org-feed.el: Use a value of <link> as guid if <guid> is
missing
* lisp/org-feed.el (org-feed-parse-rss-feed): Set a value of <link>
element to `:guid' property of an entry if <guid> element is missing.
If a RSS feed does not provide <guid> to entries, `:guid' property of an
entry is always `nil'. In such a case, new feed entries are no longer
added because the property is used to detect duplication.
TINYCHANGE
---
lisp/org-feed.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index e511be0..7be803e 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -615,8 +615,10 @@ containing the properties `:guid' and `:item-full-text'."
(match-beginning 0)))
(setq item (buffer-substring beg end)
guid (if (string-match "<guid\\>.*?>\\(.*?\\)</guid>" item)
+ (org-match-string-no-properties 1 item))
+ link (if (string-match "<link\\>.*?>\\(.*?\\)</link>" item)
(org-match-string-no-properties 1 item)))
- (setq entry (list :guid guid :item-full-text item))
+ (setq entry (list :guid (or guid link) :item-full-text item))
(push entry entries)
(widen)
(goto-char end))
--
2.5.3
reply other threads:[~2015-09-23 12:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFEtL0d=qZ7VPPmPLW3ROJV3Tv6mYZB_nFbz9Ofjri9Qt-6wsQ@mail.gmail.com' \
--to=monodie@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).