转载

[iOS] ReadabilityKit:超实用的文章、新闻内容图文摘要提取工具库

ReadabilityKit

ReadabilityKit helps you to extract a relevant preview (title, description, image and video) from the URL.

The goal is to try and get the best extraction from the article for servicing applications that need to show a preview of a web URL along with an image. Comparison with other extraction libraries availablehere. Comparison with another iOS extraction library (SwiftLinkPreview) availablehere.

Inspired bysnacktory andnewspaper.

Demo

[iOS] ReadabilityKit:超实用的文章、新闻内容图文摘要提取工具库

Features

Extracts:

  • Title
  • Description
  • Top image
  • Top video
  • Keywords

Requirements

  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+

Usage

let parser = Readability(url: articleUrl)

let title = parser.title()
let description = parser.description()
let keywords = parser.keywords()
let imageUrl = parser.topImage()
let videoUrl = parser.topVideo()

To run the example project, clone the repo, and run pod install from the Example directory first.

Comparison with other libraries

ReadabilityKit SwiftLinkPreview python-goose snacktory newspaper
github :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
washingtonpost :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
youtube :white_check_mark: :x: :ballot_box_with_check: :white_check_mark: :ballot_box_with_check:
vimeo :white_check_mark: :x: :white_check_mark: :white_check_mark: :ballot_box_with_check:
instagram :white_check_mark: :white_check_mark: :ballot_box_with_check: :white_check_mark: :white_check_mark:
nytimes :ballot_box_with_check: :white_check_mark: :x: :white_check_mark: :white_check_mark:
twitter :ballot_box_with_check: :ballot_box_with_check: :x: :white_check_mark: :x:
medium :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
facebook :white_check_mark: :ballot_box_with_check: :ballot_box_with_check: :ballot_box_with_check: :white_check_mark:
imgur :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
flickr :white_check_mark: :white_check_mark: :x: :white_check_mark: :white_check_mark:
500px :white_check_mark: :x: :x: :white_check_mark: :white_check_mark:
dribbble :white_check_mark: :white_check_mark: :ballot_box_with_check: :white_check_mark: :white_check_mark:
lenta :white_check_mark: :white_check_mark: :ballot_box_with_check: :white_check_mark: :white_check_mark:
habrahabr :white_check_mark: :white_check_mark: :ballot_box_with_check: :white_check_mark: :white_check_mark:
bbc :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

:white_check_mark: – correct :ballot_box_with_check: – partially correct :x: – incorrect

ReadabilityKit vsSwiftLinkPreview

  • ReadabilityKit uses part ofar90 algorithm which was transformed into the Redability.com product. This allows for more accurate extraction.
  • Video support. ReadabilityKit detects videos on the page and extracts the most relevant to Readability.topVideo .
  • Typed API that allows you to use statically typed properties without force casting.
  • Better threading model. You can use ReadabilityKit with both sync or async calls.
  • Keyword extraction.

Installation

CocoaPods

ReadabilityKit is available through CocoaPods . To install it, simply add the following line to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'ReadabilityKit'
end

Carthage

To integrate ReadabilityKit into your Xcode project using Carthage, specify it in your Cartfile :

github "exyte/ReadabilityKit" ~> 0.4.6

Manually

  1. InstallJi XML parser
  2. Download and drop ReadabilityKit.swift in your project
  3. Congratulations!

Author

exyte, info@exyte.com

License

ReadabilityKit is available under the MIT license. See the LICENSE file for more info.

原文  https://github.com/exyte/ReadabilityKit
正文到此结束
Loading...