Loading and selecting an external DOM Element with jsdom
I’m trying to write a module which loads a DOM-element of a remote URL with JSDOM.
Example usecase: Displaying the current onair artistname and songtitle of a radio station.
(In the example: The Span-Elements with the class “playing” at https://fm4.orf.at/player/live)
@fewieden did something similar before, but I’m not able to adapt it:
I can’t get jsdom to work at all. Anybody could have a look and have some tips? Do I need to put it into a node_helper?
i can work on it more in a couple hours… (grandson socker game)
I misread it in a hurry…
worked thru it, further down
Also, you can’t use require in the module.js
Only in node_helper.
Turn on the developers window, ctrl-shift-i , and select the console tab and scroll up to see any errors
@anyhowat i updated your code to a small working sample… i created a pull request back to you with the updates
but the node you are looking for on the site (span.playing) does not exist.
I added debugging to dump the content returned from the jsdom api request
also, after installing your module (or pulling my updates after merge), you need to do
in the module folder, to get the jsdom library loaded from your module
Sam, thanks. That’s awesome.
I’ll dig into the changes right now. Made my day.