https://github.com/michan18/webparser
A web parser for iOS to parser a particular html tag by id or class elements
https://github.com/michan18/webparser
cocoapods swift4 webparser xcode10
Last synced: 3 months ago
JSON representation
A web parser for iOS to parser a particular html tag by id or class elements
- Host: GitHub
- URL: https://github.com/michan18/webparser
- Owner: michan18
- License: mit
- Created: 2019-01-21T23:24:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-22T02:09:37.000Z (over 6 years ago)
- Last Synced: 2025-02-24T21:02:41.768Z (4 months ago)
- Topics: cocoapods, swift4, webparser, xcode10
- Language: Swift
- Homepage:
- Size: 75.2 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webparser
A web parser for iOS to parser a particular html tag by id or class elementsWebparser is now available for CocoaPods! Simply include 'webparser' in your podfile.
## How to use WebParsing
Suppose, we have a file like the following as HTML tag
```HTML
```
you can parse the page by either the id or class parameter
```swift
import webparser
let url = parser.init()
url.get_the_page_info(body_prase: ["page","container-width-only"], return_method: "HTML", url_string: url_string!, {(title, description, previewImage,body_div) -> Void in
print(body_div["article_body"])
}
, failure: { (errorMessage) -> Void in
print(errorMessage)
})
```
## Steps & functionsInitialise parser.init()
Now you can use the function
```swift
get_the_page_info(body_prase:[String],return_method:String,url_string:URL,_ completion: @escaping ((_ title: String?, _ description: String?, _ previewImage: String?,_ body_div:[String:[String]] ) -> Void), failure: @escaping ((_ errorMessage: String) -> Void))
```
Input parameters:
1) body_prase --> String Array eg) ["page","container-width-only"]
2)return_method ---> String which will accepet either "HTML" or "TEXT
3)url_string ---> URL datatype
Output Parameter:
1) title: String?, --> will return Titte of the page
2) description: String?,--> will return Description of the page
3) previewImage:: String? will return preview image of the page just like seen in facebook
4) body_div:[String:[String]] --> which will parse the url will return a array dictionary with key ad Input parameter given in body_prase