Giter Club home page Giter Club logo

webparser's Introduction

webparser

A web parser for iOS to parser a particular html tag by id or class elements

Webparser 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

 <div id="page" class="configurable story " data-story-id="world-europe-46955006">      
   <div role="main"> 
     <div class="container-width-only">
     </div>
   </div
 </div>

you can parse the page by either the id or class parameter

  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 & functions

Initialise parser.init()

Now you can use the function

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

webparser's People

Contributors

michan18 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

zjc19891106

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.