scinfu / SwiftSoup

SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
https://scinfu.github.io/SwiftSoup/
MIT License
4.52k stars 345 forks source link

Get "#document" element #183

Closed swifthing closed 1 year ago

swifthing commented 3 years ago

Hello,

Firstly thank you for this tool, swiftsoup is amazing

I have some question: how to get elements inside "#document" ?

Here in this link https://www.ultimedia.com/default/index/videogeneric/id/q0kxs3r

I want to get the url of the video, but it is inside a "iframe", and inside it there is "#document".

This is how I'm trying :

let doc = try? SwiftSoup.parse(contents)
let videoLink = doc.select("video#player-player_html5_api").attr("src")

But videoLink is empty ...

Can you help me ?

scinfu commented 2 years ago

try to print the result and see if there is an attribute src