0

Is there a way ( library or program ) to download the result of a web page (like curl or wget) where you can just apply some javascript the same way you could on chrome's developer tools from cpp or bash ?

The goal would be to use it with jQuery's selectors (admitting said website uses jQuery. Or better, to add jQuery to the processed html to be able to process it that way)

I haven't found anything on the subject on google.

I'm not really sure if I made myself clear, so i'll provide an exemple.

For instance let's say I want to get this question's (How to undo last commit(s) in Git?) accepted answer's code, it'd do

content = page.apply_js("$('div.accepted-answer pre code').text()");

and it would make content contain

$ git commit -m "Something terribly misguided"              (1)
$ git reset HEAD~                                           (2)
<< edit files as necessary >>                               (3)
$ git add ...                                               (4)
$ git commit -c ORIG_HEAD                                   (5)

I know that there are some shady details left unexplicited here, including type-correctness, but that is not the point.

Community
  • 1
  • 1
Pierre-Antoine Guillaume
  • 1,047
  • 1
  • 12
  • 28

0 Answers0