-
Notifications
You must be signed in to change notification settings - Fork 38
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
Download inline images via org-download #28
Comments
Hi, You're welcome, I'm glad you find it useful. That's an interesting idea. I think it's possible, but it would take some work. I think it would go something like this:
Another possibility might be to use a different package altogether. For example, I haven't tried it yet, but What do you think? |
First thanks for creating the snippet. It's really useful to store local copy of important articles. I digged for a while, and found that
So for Kitchen's page, I tried with:
And it works nicely, the org finds the correct path. Then it seems to me that, if we pass in I took a look at |
Seems that in this way we can get the best of both |
I figured out a snippet to download all image links using org-download (defun search-forward-and-org-download-images()
"Search forward for HTTP Image URLs, replace each using
org-download-image to obtain a local copy."
(interactive)
(while (re-search-forward org-bracket-link-regexp nil t)
(let* (
(end (match-end 0))
(beg (match-beginning 0))
(s (buffer-substring-no-properties beg end))
(match? (string-match org-bracket-link-regexp s))
(link (match-string 1 s))
)
(when (string-match "^http.*?\\.\\(?:png\\|jpg\\|jpeg\\)\\(.*\\)$"
link) ;; This is an image link
(message (concat "Downloading image: "link))
(delete-region beg end)
(org-download-image link)
(sleep-for 1) ;; Some sites dislike frequent requests
)))) So before finish the capture, I would run this command to download all images. Hope that's helpful. |
That code doesn't have error checking, so if |
Indeed, just a snippet as POC. Do you plan to integrate features like this? I mean, your tool with |
Maybe sometime. I haven't been able to use this tool lately because I haven't been able to get my browser to work with the MIME type to connect it to |
@alphapapa We already supplied a couple of instructions on how to register the org-protocol handler in pull requests: https://github.com/alphapapa/org-protocol-capture-html/pull/33/files https://github.com/alphapapa/org-protocol-capture-html/pull/36/files Maybe those guides would help. I also during some updates use to lose the handler also, and by using my guide I redid the procedure - it helped. |
@Anton-Latukha Just curious, is that the "royal we" or do you represent more than just yourself? :) I'll post on those PRs again. |
I really love myself. Even messaged in two links to two PRs of two different people. That share info on the topic you were concerned about. If we merge them - we even may help other people with that. I just helping to progress this discussion by helping you solve #28 (comment) |
Now, the image links are stripped of the website prefix, how can I fix this. |
Hi, @alphapapa
Thanks for this great package. I would like to download inline images via org-download during capturing but I don't know where to start. Is it possible? If so, could you shed some light on how to achieve this? Thanks!
The text was updated successfully, but these errors were encountered: