scinfu/SwiftSoup

how to use SwiftSoup in oc?

yueyuedede1 opened this issue · 4 comments

how to use SwiftSoup in oc?

Sorry, but what do you mean with oc?

javascript on/cookie support

I'm new to web stuff, so the question is regarding retrieving price data from https://steamdb.info/app/1063970 by parsing page and looking for key words. But in my case I don't have body data and have messages about turning Javascript on and enabling cookies. Is SwiftSoup a proper tool?

linux, swift-5.6.1-RELEASE

p.s. sorry for not creating a new issue, the button is just grey and I can't push it to create new issue

how to use SwiftSoup in objective-c language

You can't directly, you'll need to create a Wrapper.
SwiftSoup is a pure Swift library, if we add compatibility with Obj-C we lose compatibility with Linux.

import SwiftSoup
@objc class Wrapper: NSObject {
    @objc static func parseHTML(html: String) -> String {
        let doc: Document = try! SwiftSoup.parse(html)
        return try! doc.text()
    }
}

and

#import "ProjectName-Swift.h"
NSString *txt= [Wrapper parseHTML:@"<html></html>"];