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

empty doc.location() #245

Open ukushu opened 1 year ago

ukushu commented 1 year ago

I'm trying to get target url from google's "I'm feeling lucky" request

as example I have an url:

https://www.google.com/search?q=youtube+portal+2+walkthrough+no+commentary&btnI

I'm doing request via SwiftSoup. I see html() of youtube site. So SwiftSoup doing all right.

BUT!

    guard let doc: Document = getHTMLDoc(from: queryUrl) else { return nil }

    let url2 = doc.location() // "" (empty)
    let url = doc.getBaseUri() // "" (empty)

so SwiftSoup can absolutely correctly get html, but don't know where from this html was taken.

Absolutely strange behavior.