Hello, I use org-capture through org-protocol to store web pages to read later. It works well, but I would like to improve it by first checking if I have already stored the page (and in this case not capture it, but have a message telling me so).
To give more context, here is for instance the bookmarklet to capture a
youtube page, storing the channel name and video duration (this is
overkill for this particular example, but others might find it useful):
javascript:location.href = 'org-protocol://capture?' +
new URLSearchParams({
template: "v",
url: location.href,
title: document.title +
" (" +
document.querySelector("span[itemprop='author'] >
link[itemprop='name']").getAttribute("content") +
", " +
document.querySelector(".ytp-time-duration").textContent +
")"
});
void(0);
This is currently stored using this org-capture template:
(setopt org-capture-templates
`(…
("v"
"org-protocol for video"
entry (
file
,(concat
notes-directory
"20250828T131843--youtube-videos-to-watch__list_video_youtube.org"))
"* %a :%(format-time-string \"%Y\"):watchlog:\nCaptured On: %U"
:immediate-finish t)
… ))
How can I change the template (or something else) to first run a
function to decide if the capture should proceed? (I need to have access
to the link in that function, but I think I can recover it with
(plist-get org-store-link-plist :link).)
Best,
Alan
signature.asc
Description: PGP signature
