Home / GitHub Page

Grab a page/article from web to joplin for creating new notes


#1

Regarding this, Importing markdown file from command line, will it be possible to grab a webpage directly from Joplin by entering an URL (in the title field or in a dedicated field) ?

I think I saw that from Owncloud editor. Or even in “Pocket


#2

Most likely that won’t be possible. The reason is that in most HTML pages there are plenty of invisible elements - they are hidden either via CSS or JavaScript -, so to get the page as intended without these invisible elements and to convert it to Markdown you essentially need to run it through a browser.

This can be done from the web clipper since it runs from a browser, but not directly from Joplin, which doesn’t run one.

So most likely it will only be possible to grab HTML content from the web clipper.


#3

i can imagine.
thanks


#4

One idea comes to my mind now you released the webclipper :slight_smile:

drum roll… can’t we use the code of webclipper as vector to grab the html article and add it to joplin desktop ? :)=

Also, now that you’ve opened a door with HTTP port to joplin-desktop, wont it be possible for us to use it to “POST” data to create note too? :smiley:
I know I exaggerate :smiley: but the possibilities are much better than before :slight_smile:


Web Clipper is now available (BETA feature)
Web Clipper is now available (BETA feature)
#5

Yes the Clipper service that runs to support the extension is actually quite generic and can be used for other things. Once it’s stable I plan to document it properly, but basically you can already use it like this:

First, get the port where it is running by going in Options > Web clipper options. Usually it’s 41184, but it can be something else depending on your system.

Check that you can reach it like this:

curl http://127.0.0.1:41184/ping

To create a simple markdown note, you can do this:

curl -H 'Content-Type: application/json' --data '{"title":"my note", "body":"some markdown"}' http://127.0.0.1:41184/notes

To convert HTML to Markdown you can do as below, but keep in mind that (as mentioned above) if the HTML has hidden elements it will look messy.

curl -H 'Content-Type: application/json' --data '{"title":"my note", "bodyHtml":"some html code"}' http://127.0.0.1:41184/notes

You can even post an image in the data-url format:

curl -H 'Content-Type: application/json' --data '{"title":"my note", "imageDataUrl":"data:image/jpeg;base64,/9j/4AAQSkZJR"}' http://127.0.0.1:41184/notes

#6

wonderful !
finally a dreaam comes true :smiley:


#7

As webclipper is now available, with Jong I added the possibility to use webclipper if it is started.
With browser Webclipper we can select the notebook where to store the note that will be created once grabbed.

I tried the same with:

curl -H 'Content-Type: application/json' http://127.0.0.1:41184/notes --data '{"title": "Community, Jong", "body": "Le voici de retour pour aborder", "notebook": "Projets", "author": "foxmask", "source_url": "https://foxmask.net/post/2018/05/24/joplin-community-jong/"}'

but the notebook is not taken into account, the note is created in the last created notebook, so I supposed that author and source_url ignored too?

What properties of data can we provide ? just title, body(Html) and imageDataUrl ?


#8

@foxmask, there’s a new command to get the list of folders:

curl http://127.0.0.1:27583/folders 

From this list get the notebook “id”, and then you can specify it when creating the note using the “parent_id” property. For example:

curl -H 'Content-Type: application/json' http://127.0.0.1:41184/notes --data '{"title": "Community, Jong", "body": "Le voici de retour pour aborder", "parent_id": "fd78919d805f427491f22908c11eea6c", "author": "foxmask", "source_url": "https://foxmask.net/post/2018/05/24/joplin-community-jong/"}'

Also the “author” property is not supported at the moment, and url should be passed as just “url”.


#9

I see, great :=) thank you


#10

Actually just writing this makes me realise the API is not very consistent with the backend (url/source_url, parentId/parent_id), which I’d like to avoid. So I’m going to change all this soon - the properties will basically map to whatever is in the database, etc.


#11

Ok, i’ll do nothing until a new version :sunglasses: