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 available here. Comparison with another iOS extraction library (SwiftLinkPreview) available here.
Inspired by snacktory and newspaper.
Extracts:
- Title
- Description
- Top image
- Top video
- Keywords
- iOS 8.0+ / Mac OS X 10.10+ / tvOS 9.0+ / watchOS 2.0+
Readability.parse(url: articleUrl, { data in
let title = data?.title
let description = data?.description
let keywords = data?.keywords
let imageUrl = data?.topImage
let videoUrl = data?.topVideo
})
To run the example project, clone the repo, and run pod install
from the Example directory first.
ReadabilityKit | SwiftLinkPreview | python-goose | snacktory | newspaper | |
---|---|---|---|---|---|
github | ✅ | ✅ | ✅ | ✅ | ✅ |
washingtonpost | ✅ | ✅ | ✅ | ✅ | ✅ |
youtube | ✅ | ❌ | ☑️ | ✅ | ☑️ |
vimeo | ✅ | ❌ | ✅ | ✅ | ☑️ |
✅ | ✅ | ☑️ | ✅ | ✅ | |
nytimes | ✅ | ✅ | ❌ | ✅ | ✅ |
✅ | ☑️ | ❌ | ✅ | ❌ | |
medium | ✅ | ✅ | ✅ | ✅ | ✅ |
✅ | ☑️ | ☑️ | ☑️ | ✅ | |
imgur | ✅ | ✅ | ✅ | ✅ | ✅ |
flickr | ✅ | ✅ | ❌ | ✅ | ✅ |
500px | ✅ | ❌ | ❌ | ✅ | ✅ |
dribbble | ✅ | ✅ | ☑️ | ✅ | ✅ |
lenta | ✅ | ✅ | ☑️ | ✅ | ✅ |
habrahabr | ✅ | ✅ | ☑️ | ✅ | ✅ |
bbc | ✅ | ✅ | ✅ | ✅ | ✅ |
✅ – correct ☑️ – partially correct ❌ – incorrect
ReadabilityKit vs SwiftLinkPreview
- ReadabilityKit uses part of ar90 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.
- Keyword extraction.
ReadabilityKit is available through CocoaPods. To install it, simply add the following line to your Podfile
swift 3.0:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'ReadabilityKit'
end
Legacy swift 2.3:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'ReadabilityKit', '0.5.4'
end
Legacy swift 2.2:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'ReadabilityKit', '0.5.2'
end
To integrate ReadabilityKit
into your Xcode project using Carthage, specify it in your Cartfile
swift 3.0:
github "exyte/ReadabilityKit"
Legacy swift 2.3:
github "exyte/ReadabilityKit" "0.5.4"
Legacy swift 2.2:
github "exyte/ReadabilityKit" "0.5.2"
- Install Ji XML parser
- Download and drop all files from Sources folder in your project
- Congratulations!
This project is maintained by the exyte company, a team of experienced software engineers from the cold Siberia. We don't have bears and don't like vodka, but we love to create great applications! Just contact us.
ReadabilityKit is available under the MIT license. See the LICENSE file for more info.