Coder Social home page Coder Social logo

exyte / readabilitykit Goto Github PK

View Code? Open in Web Editor NEW
830.0 37.0 76.0 19.18 MB

Preview extractor for news, articles and full-texts in Swift

License: MIT License

Swift 96.45% Ruby 1.47% Objective-C 2.08%
swift extract preview swift-package-manager

readabilitykit's Introduction

ReadabilityKit

Preview extractor for news, articles and full-texts in Swift


We are a development agency building phenomenal apps.




License: MIT Cocoapods Compatible Carthage Compatible

!Project is now archived!

No further maintenance will be performed

Features

Extracts:

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

Usage

let articleUrl = URL(string: "https://someurl.com/")!
Readability.parse(url: articleUrl, completion: { data in
    let title = data?.title
    let description = data?.description
    let keywords = data?.keywords
    let imageUrl = data?.topImage
    let videoUrl = data?.topVideo
    let datePublished = data?.datePublished
})

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

Installation

pod 'ReadabilityKit'
github "exyte/ReadabilityKit"

Manually

  1. Install Ji XML parser.
  2. Download and drop all files from Sources folder in your project.

Development Environment Setup

  1. Install Carthage.
  2. Check out and build the project's dependencies:
carthage bootstrap --platform <name>

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+

License

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

readabilitykit's People

Contributors

elland avatar f3dm76 avatar jwd-ali avatar lfarah avatar mgoldin avatar morissonmaciel avatar shipinev avatar vhailor13 avatar zapletnev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

readabilitykit's Issues

iOS 11, Swift 4, Xcode 9

Just a heads up, some parsing in Readability doesn't work for iOS 11 and Swift 4. If you'd like, I can take a look into these issues and commit some changes to another branch?

Project structure refactoring.

Move ReadabilityKit workspace to root.
Add Example as separate project.
Move tests to ReadabilityKit workspace from Example project.

Twitter and Youtube not been parsed

Hi,

In the initial testing of this Kit, I found out that it is unable to find parse the any data from the following,

  • Twitter

  • Youtube

Any ideas, as to what would be causing this issue, would be helpful.
Thanks.

Carthage: error: module compiled with Swift 4.0 cannot be imported in Swift 4.0.2

Running carthage update fails on the most recent version of Xcode.

error: module compiled with Swift 4.0 cannot be imported in Swift 4.0.2: /Users/sam/Documents/dev/DispatchApp/Carthage/Checkouts/ReadabilityKit/Dependencies/iOS/Ji.framework/Modules/Ji.swiftmodule/arm64.swiftmodule
Build version 9B55

I'm happy to submit a PR to fix, but I'm unsure how to get the libraries from the Ji project.

Some URLS are not parsed.

Some URLS are not parsed? It's either that or the URLSession request takes quite long to parse the data. Is there a way to improve its speed/performance?

iOS 10 App Transport Security

In iOS 10, Apple has promised to turn off ATS for developers who want to submit to the App Store. In this scenario, what are the plans to support this?

Employ asynchronous patterns

I would suggest that this code excise its use of dispatch semaphores to make the fundamentally asynchronous NSURLSession behave synchronously. Apple made this asynchronous for a reason.

If a user accidentally called this from the main thread, you'd block the main thread, which results in behaviors ranging from a poor UX to an app possibly getting killed by the watchdog process. Worse, if a user called this from within their own NSURLSession completion handler (e.g. http://stackoverflow.com/q/39253599/1271826), this will deadlock their code.

I'd also suggest that you not initiate the asynchronous method from within the init method. By convention, one should generally configure the object from within init, and then have a separate method to start the process.

Swift 3 Help

Ji.swift and JiNode.swift are both broken in swift 3. Can't figure out how to fix them with things like "openlass", "fileprifilevate", opeoppened" etc.

Manual Installation

CocoaPods is an awesome tool and make our life really easier, but there are some devs who still don't know how to use them.

It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

GIF

I'd be cool to show a GIF or an Image showing the power of ReadabilityKit

Incorrect description of articles

Try to load articles
"http://www.jobsnhire.com/articles/35030/20160214/need-know-cvs-health.htm"
"http://www.bbc.com/news/world-asia-china-37081013"
"http://www.bbc.com/culture/story/20160805-when-shocking-images-must-be-covered-up"
"http://football.ua/germany/311510-podolski-zavershil-kareru-v-sbornojj.html"

using code
let sURL = "http://football.ua/germany/311510-podolski-zavershil-kareru-v-sbornojj.html"
let articleUrl = NSURL(string: sURL)

    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()

For all this articles parser.description() returns only their first paragraph.

Can't build framework (Carthage + Xcode 8.2.1)

When trying to build ReadabilityKit 0.6.0 using carthage update --platform iOS, it gets to Building scheme "ReadabilityKit iOS" in ReadabilityKit.xcodeproj before saying ** BUILD FAILED **. The full output:

** BUILD FAILED **


The following build commands failed:
	CompileSwift normal arm64
	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
A shell task (/usr/bin/xcrun xcodebuild -project /Users/orion/Dropbox/Code/Feeds/Carthage/Checkouts/ReadabilityKit/ReadabilityKit.xcodeproj -scheme "ReadabilityKit iOS" -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
	CompileSwift normal arm64
	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)

When changing the target in my Cartfile to 0.5.4, it builds fine.

Initializer for conditional binding

Building example and get error:

Initializer for conditional binding must have Optional type, not 'String'

From Readability+Networking.swift:

guard let urlStr = url.absoluteString else {
return
}

Can change to the following to fix:

let urlStr = url.absoluteString

Thanks.

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.