Latest 1.0.4
Homepage https://github.com/vincode-io/VinContent
License MIT
Platforms ios 8.0, osx 10.10
Authors

HTML Main content extractor for Swift

Main content extraction is the process of extracting relavant text from an HTML page. Relavant text is the
text that a typical person is interested in reading. In most cases this is an article. What isn’t relavant,
advertisements and other junk, is discarded.

A common usage of main content extraction is Safari’s Reader functionality. Other implementations of this are
Goose, Dragnet, Newspaper, and many more.

Usage

VinContent has a small API implemented using the delegate pattern.

Example usage:

import VinContent

class WebBrowser: ContentExtractorDelegate {

    var contentExtractor: ContentExtractor?

    func yourMainProcess() {

         // You can supply either a URL, HTML as a String or both.
         // The more information you give VinContent, the better it will do.
         // If HTML is supplied, a VinContent will not do a network request to
         // get the information.  If the URL is supplied, but not the HTML
         // VinContent will retrieve the page for you.

         contentExtractor = ContentExtractor(url: yourURL, html: yourHTML)

         // This class implements the ContentExtractorDelegate methods
         contentExtractor.delegate = self

         // Initiate the process.  It will run in the background without doing
         // anything on your part.  The delegate methods will be called on the
         // main thread.
         contentExtractor.process()

    }

    // This is the first delegate method to implement.  It will be called if there
    // are any problems while processing the HTML document.
    func contentExtractionDidFail(with error: Error) {
       // Perform normal error handling here.
    }

    // This is the second delegate method.  It will be called after the page
    // is downloaded (if necessary) and processed.
    func contentExtractionDidComplete(article: ExtractedArticle) {
       // Display the stripped down article here.
    }

}

Installation

CocoaPods

Just add the line below to your Podfile:

pod 'VinContent'

Then run pod install

Carthage

Coming soon…

Swift Package Manager

Coming soon…

License

MIT

Latest podspec

{
    "name": "VinContent",
    "version": "1.0.4",
    "summary": "HTML main content extraction for Swift",
    "description": "VinContent is a main content extraction library for Swift.  Main content extraction isnthe process of extracting relavant text from a HTML page.  Relavant text isntext that a typical person is interested in reading.  In most cases this is an article.  nWhat isn't relavant, advertisements and other junk, is discarded.",
    "homepage": "https://github.com/vincode-io/VinContent",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Maurice Parker": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "swift_version": "4.0",
    "source": {
        "git": "https://github.com/vincode-io/VinContent.git",
        "tag": "1.0.4"
    },
    "source_files": [
        "Sources",
        "Sources/**/*.{swift,h,m}"
    ],
    "xcconfig": {
        "HEADER_SEARCH_PATHS": "$(SDKROOT)/usr/include/libxml2",
        "SWIFT_INCLUDE_PATHS": "$(PODS_ROOT)/VinContent/Sources/VinXML"
    },
    "preserve_paths": "Sources/VinXML/module.modulemap",
    "resources": [
        "Sources/VinContent/stopwords.txt",
        "Sources/VinContent/incompatible_hosts.txt"
    ]
}

Pin It on Pinterest

Share This