Welcome to the wonderful world of Security Vulnerabilities and Work-arounds. Don't worry, this is my job.
OK, you need to register a new URL scheme handler. First create a Desktop Entry which specifies the mime-type. For example:
[Desktop Entry]
Type=Application
Name=TW Bash Script
Exec=twscript.sh %u
StartNotify=false
MimeType=x-scheme-handler/twscript;
Once you have created this Desktop Entry and installed it (put it in the local system applications directory ( ~/.local/share/applications/ or /usr/share/application/ ) then you must register the application with the MIME type (assuming you had named your Desktop Entry twscript.desktop
xdg-mime default twscript.desktop x-scheme-handler/twscript
Any script can then be added to the twscript.sh (make sure it's executable of course) and you can parse parameters just as any other script. The script should be placed anywhere in your executable path ~/.local/bin for example.
In the twscript.sh you'll have to add whatever parsing you need. You can't run separate scripts, but parameters are passed and can be checked and dealt with as appropriate.
Now, when an application finds the URL twscript:// it knows exactly what to do with it.
WARNING! This will make your system vulnerable to anybody who knows the MIME type that you have used. They could create a script which would execute on your computer. I would advise against this, but there you go.
Have fun,
Dragon.