Smart copy internet page source in one key. Firefox + vimperator.

2.2.2016 654 views ;)

Today i want to show how to make smart copy full webpage in one key press.

What for it ?
I’m use it for prcessing it. Parse. Copy any page, put it to my DevelStudio project and extract media, urls, anchors, titles and etc.

Which info to copy ?

  1. url
  2. source

How to copy it both ?
copy URL.separator.source

let separator will text string: ‘-=736872648273628=-‘
then copy result of any page will:

url+'-=736872648273628=-'+html

Tools to do it:
Firefox + Vimperator intalled

We need to modify vimperator config:

c:\Users\jkeks\_vimperatorrc

Put there line:

:map <silent> w :js util.copyToClipboard
(window.content.location.href+'-=736872648273628=-'+
window.content.document.documentElement.innerHTML, true)<cr>

This is hard to understand, but lets do it:

  1. :map – assign function to key
  2. <silent> – silent mode vimperator
  3. w – is a key, choose you want
  4. :js – next code is JavaScript
  5. util.copyToClipboard – specify for vimperator command to copy anything to clipboard
  6. window.content.location.href – JavaScript URL of page
  7. window.content.document.documentElement.innerHTML – source code of web page
  8. <cr> – it’s just press Enter key

When config is saved, reload it in Firefox:

:source ~/_vimperatorrc

Now press ‘w’ on any page and url+source will copied to clipboard.

There is one hack to save this information to the file? and out code will be more harder:

:map <silent> w :js (function(){var f = new io.File('~/testfile'); 
f.write(window.content.location.href+'-=736872648273628=-'+window.content.document.documentElement.innerHTML); 
delete f;})()<cr>:echo"Copied"<cr>

here we use JavaScript function for execute more then one command. Also we use io.File to save source to file. Realy nice shit. But it’s work fine on Windows.
Saved file we can check automaticly for new dump and start work next precess.

Thank you guys and walcome back.


Last 5 records:

   


Smileys
Timer
Chat roulette
Virus Detector
Calculator
Vibrator
Check domain for available
Random number generator
Referral link gen
Detector external links
Math questions
Online piano
Today: 2017.09.26