Hooking a JS script at node submission to alter data submitted
You can look into either https://www.drupal.org/project/sanitizable or 
https://www.drupal.org/project/pasteformat both does the job.

and if you are looking hook based solution, i would suggest you hook_node_presave worth looking their documentation.