Home    |    GitHub Page    |    API    |    FAQ

Script to web clip pages in android

I made a bash script to web clip pages in android

Requirements

Termux

Steps

  1. Install termux
  2. Create bin directory and open that directory
    mkdir bin && cd bin
  3. Create termux-url-opener file
    nano termux-url-opener
  4. Paste below code in termux-url-opener and save it
#!/data/data/com.termux/files/usr/bin/bash

curl -s --data-urlencode "u=$1" "http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0" -o temp.md
TITLE=$(head -n 3 temp.md | tail -n 1 | tail -c +3)
am start --user 0 -a "android.intent.action.SEND" -n "net.cozic.joplin/.share.ShareActivity"  -e "android.intent.extra.TITLE" "${TITLE}" -e "android.intent.extra.TEXT" "$(cat temp.md)"
rm temp.md
  1. Give execute permission to termux-url-opener
    chmod +x termux-url-opener
  2. Share web page url to termux , It will automatically create note along with page content in Joplin

Demo Video

Note:

  1. Not all web pages support web clipping
  2. Some websites not clipped perfectly

Without termux(May be worked in IOS)

  1. Use this bookmarklet
javascript:location.href='http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&u='+encodeURIComponent(document.location.href);

2.Select all markdown output then share to Joplin

Thanks for @laurent for creating amazing application

Sorry for my bad english (English is not my native language)

10 Likes

@RakeshKumar, this is really useful and works very well.

Very clear instructions, no problem to follow.

The web-clip is placed in the notebook last open, is that correct?

Very well done!

:trophy: :+1:

@johano
Yes,That is the default behavior of Joplin android.
If you directly share url to Joplin instead of termux it also places note in the notebook last open.

1 Like

Very nice. We need to update the share to Joplin android function with this kind of code. I use Joplin every day and would love a better share function.

I will definitely try this ! Excellent elegant hack :slightly_smiling_face: