Re: Parsing Javascript simply


Sandor Szatmari
 

We use a WebView/WKWebView for accessing web page DOMs using xPath queries.  We used to be able to even interact with Java Applets, but security improvements have killed that functionality after 10.6.  And Applets are a dead technology for the most part.    We still support 10.6 to interact with legacy web pages.  Please, I hope they go away!  But a great deal can still be accomplished this way.  Using the delegates will let you know when the page loads are complete and the DOM is in it’s final state.  Make sure to query after that to ensure the javascript is loaded/interpreted.

Sandor

On Dec 3, 2019, at 17:48, Graham Cox <graham@...> wrote:

Thanks - indeed simple to try, but unfortunately doesn’t work in this case.

I’ll try loading it into an off-screen WKWebView.

—Graham



On 3 Dec 2019, at 12:47 pm, Quincey Morris <quinceymorris@...> wrote:

I tried something similar recently, and got better-than-anticipated results using this NSAttributedString initializer:


IIRC, this gave me an attributed string with (Javascript-generated) links embedded, so you might have to scan for ”a” tags instead of “video” tags. I dunno, it might not work for you, but it should be simple to try.


Join {cocoa@apple-dev.groups.io to automatically receive all group messages.