Git Product home page Git Product logo

feedkit's People

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

feedkit's Issues

FeedParser.parse(_:) (and friends) take a closure callback, but work is synchronous?

Why does FeedParser.parse(_:) take a closure when it could simply return a value?

The gist of what it does is this:

func parse(_ result: @escaping (Result) -> Void) {
    self.result = result
    self.parse()
    ...
    self.result?(someResult)
}

So... why not just do this and not confuse the user?

func parse() -> Result {
    self.parse()
    ...
    return someResult
}

Better yet, dispatch your work to a background queue and make use of the interface you defined:

func parse(_ result: @escaping (Result) -> Void) {
    self.result = result
    DispatchQueue.global().async {
        self.parse()
        ...
        self.result?(someResult)
    }
}

Task Failed

NSURLConnection finished with error - code -1001
HTTP load failed (error code: -999 [1:89])

What should I do ?

xml encoding

Hi, while using your library I came across a feed whose xml is encoded using ISO-8859-1 instead of UTF-8. this makes the FeedDataType return nil and so does te FeedParser constructor, making it impossible to parse the feed. is there anyway you could add support for other encoding standards for xml? Thank you in advance

Multiple Feeds

Hi! I would like to get all the items sorted by date published from 4 different RSS feeds. How would I be able to do so? Does FeedKit support dealing with multiple feeds or can you use it for only one feed?

Two Swift 4 Issues

Warnings are generated by the use of "characters" and "flatMap" v. "compactMap".

Thx!

links with /rss dont work

Issue

Parsing links with /rss do not work and return error

Optional(Error Domain=com.feedkit.error Code=-1000 "Feed not found" UserInfo={NSLocalizedFailureReason=Couldn't parse any known feed, NSLocalizedRecoverySuggestion=Provide a valid Atom/RSS/JSON feed , NSLocalizedDescription=Feed not found})

To reproduce

Example link

"http://www.independent.co.uk/sport/football/rss"

it returns same error code

Completion block gets executed twice on failure

If I parse data which happens to not be a valid feed, the completion block gets executed twice.
In Parser.swift, once in line 119 and once in line 242, which is, I believe an XMLParser delegate method. I don't know the FeedKit architecture enough to judge which one is superfluous, though.

One way to reproduce the error: Add this in the sample projects applicationDidFinishLaunching:
let url = URL(string: "https://tageswoche.ch")
URLSession.shared.dataTask(with: url! as URL) { (data, response, error) in
FeedParser(data: data!).parse({ (result) in
print("ERROR")
})
}.resume()

You will see that "ERROR" gets printed twice!

Unable to use in Objective-C project

Hi,

Is there a way I can use the framework in my Objective-C project? I imported the FeedKit framework into my Xcode project and opened it up. I saw that it has a FeedKit-Swift.h bridging header?

Is there a way I can use that, to call the Swift classes from my Objective-C code? For example I want to create an instance of the FeedParser class and call the FeedParser(URL: URL)?.parse method.

Thanks for your time, Dan.

Crash if RSS feed is not available

I was using the feed from: http://feeds.washingtonpost.com/rss/politics and all was fine, until today when the Washington Post's feed went offline. FeedKit crashes in the guard let statement for some reason, it isn't handling the error correctly.

I can reproduce this in your example project too by replacing the feedURL in FeedTableViewController.swift with the above Washington Post URL.

screen shot 2017-02-14 at 10 54 36 pm

Character encoding

Hi,

I really like your pod, it's working great except for one issue.

I'm having problems with parsing a Danish RSS feed. The strings are not coming back with correct encoding and therefore weird characters are showing up in the app.

Help would be appreciated :)

Missing pubDate data after parsing RSS feed

When parsing http://feeds.feedburner.com/ubergizmo the date field is often blank even though the pubDate field contains data inside the item, and the feed seems to parse successfully. BTW I also tested this feed with the MWFeedParser code and then the date is parsed/extracted.

e.g.

<item><title>Facebook Confirms Plans To Launch A New Subscription Service</title>
<link>http://www.ubergizmo.com/2017/07/facebook-to-launch-news-subscription/?utm_source=mainrss</link> 
<pubDate>20 Jul 2017 03:23:26 +0000</pubDate> 
<lastmodifiedDate /> 
<dc:creator>Tyler Lee</dc:creator> 
<category><![CDATA[General]]></category> 
<category><![CDATA[Facebook]]></category> 
<guid isPermaLink="false">284104</guid> 
<content:encoded><![CDATA[ <p><img
class="aligncenter size-full wp-image-187417" src="http://cdn2.ubergizmo.com/wp-content/uploads/2014/02/facebook-logo.jpg" alt="" width="640" height="480" />For the most part, a lot of online publications that are free to read rely on advertisements for generating revenue. However with ad blockers becoming more widely used, and with users turning to alternative sources for their information, new ways of generating revenue need to be invented.<span
id="more-284104"></span></p><p>Subscription services are one of those methods, and it seems that publishers will soon have the <a
href="https://www.thestreet.com/story/14233293/1/facebook-s-campbell-brown-we-are-launching-a-news-subscription-product.html" target="_blank" rel="noopener">option of using Facebook as a subscription service</a>. This was confirmed by Facebook exec Campbell Brown who said, <em>&#8220;One of the things we heard in our initial meetings from many newspapers and digital publishers is that &#8216;we want a subscription product &#8212; we want to be able to see a paywall in Facebook,&#8217; and that is something we&#8217;re doing now. We are launching a subscription product.&#8221;</em></p><p>The inclusion of this feature came about after news publications complained that they had little control over what their stories were being shared on the platform, and how companies such as Facebook and Google were benefiting from the work of newspapers without “fairly” compensating the publishers.</p><p>The tests for this new subscription service is expected to kick off this October, but details such as pricing have yet to be revealed, but we suppose we will have the official details in due time.</p> <a
href="http://www.ubergizmo.com/2017/07/facebook-to-launch-news-subscription/?utm_source=mainrss">Facebook Confirms Plans To Launch A New Subscription Service</a> , original content from <a
href='http://www.ubergizmo.com'>Ubergizmo</a>. Read our <a
href='http://www.ubergizmo.com/terms/'>Copyrights and terms of use</a>.  <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ubergizmo?a=5f7imQYQ90Y:3X9vkv7l_0Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ubergizmo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ubergizmo?a=5f7imQYQ90Y:3X9vkv7l_0Q:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ubergizmo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ubergizmo?a=5f7imQYQ90Y:3X9vkv7l_0Q:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/ubergizmo?i=5f7imQYQ90Y:3X9vkv7l_0Q:gIN9vFwOqvQ" border="0"></img></a>
</div>]]></content:encoded> 
</item>

Support for RSS 1.0

The way I read the README, FeedKit claims to support older RSS versions. It detects RSS 1.0 correctly based on the rdf:RDF tag. The RSSPath class however doesn't handle paths like "/rdf:RDF/channel/title". No information for the following feed can be parsed, for example:
http://rss.slashdot.org/Slashdot/slashdotMain

Not Able to Check Multiple Items in a Feed

Hello! In my app, I want to display the first 10 different items in a feed in a UICollectionView. I can only access the first item in a feed shown in your documentation. How would I be able to gather the first 10 items and add them to an array?

Get tag not in documentation

Hello,

I'm having some problems with a RSS Feed with some extra tags inside the tag.

schermata 2018-10-05 alle 11 45 02

I need to get values inside the red box, any way I can get them with feedkit?

Thanks

Media namespace not available on AtomFeed

Currently, media attributes are parsed only as part of an RSSFeedItem.

I may be wrong, but perhaps it should be possible for something like this:

<media:thumbnail width="40" height="40" url="https://secure.gravatar.com/avatar/1234"/>

to be contained inside an AtomFeedEntry.

Load more than 10 feed items using an index

As far as I can tell, FeedKit only fetches the last 10 RSS items in a feed.

Is it possible/would you consider adding an index to access, for example, posts 11-20? I think an index would be the best way to solve this because having just a number of items to load option would make the first load slower. I’d rather load more items as needed.

Swift 4.1

Looks like some updates are needed for Swift 4.1.
Visible warnings:flatMap is deprecated -> use compactMap.

Not up to date with Swift 3.0

e.g.

FeedParser(URL: URL)?.parse({ (result) in

    switch result {
    case .RSS(let rssFeed):
        print(rssFeed) // An `RSSFeed` model
    case .Atom(let atomFeed):
        print(atomFeed) // An `AtomFeed` model
    case .Failure(let error):
        print(error) // An `NSError` object
    }

})

Should be:

FeedParser(URL: url)?.parse({ (result) in
    
    switch result {
    case .rss(let rssFeed):
        print(rssFeed) // An `RSSFeed` model
    case .atom(let atomFeed):
        print(atomFeed) // An `AtomFeed` model
    case .failure(let error):
        print(error) // An `NSError` object
    }
    
})

Crash when no internet is available

Hi,

It seems a call will crash if there is no internet connection available.

Right now my setup is like this:

guard let url = URL(string: rssEndpoint) else {
	print("Endpoint format invalid.")
	return
}

guard let feedParser = FeedParser(URL: url) else {
	print("Failed to create parser from endpoint.")
	return
}

feedParser.parse({ (result) in
        ....
})

Where the error occurs in my second guard, when creating the parser itself.
Inspecting the error further in XCode shows that it crashes on line 56 in FeedParser.swift, in your guard statement.

Manual Installation

CocoaPods and Carthage are awesome tools 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.

parameter pubDate is nil after parsing RSS feed

Hello, I have the same problem how is he here: #31 . I parse a date: <pubDate>30 Jan 2018</pubDate> and other format <pubDate> 4 Apr 2018</pubDate> and I get nil. Can you help me? I use Carthage.

King Regards,
Tom

how to get image from this xml data

<a class="asset-img-link" href="http://ideas.typepad.com/.a/6a00d83451bb7469e201b7c8e11fbc970b-pi\" style="display: inline;"><img alt="Brandon+saigeon1" border="0" class="asset asset-image at-xid-6a00d83451bb7469e201b7c8e11fbc970b image-full img-responsive" src="http://ideas.typepad.com/.a/6a00d83451bb7469e201b7c8e11fbc970b-800wi\" title="Brandon+saigeon1" />

after using content?.contentEncoded then after i got this data so, how can i get specific image link in this data

Don't parse some info

Hello,

I have feed https://99bitcoins.com/feed/

This feed has this block

<media:content url="https://www.youtube-nocookie.com/v/zc27UFwGcZo" duration="116">
			<media:player url="https://www.youtube-nocookie.com/v/zc27UFwGcZo" />
			<media:title type="html">Bitcoin News Summary - October 15, 2018</media:title>
			<media:description type="html">Here’s what happened this week in Bitcoin in 99 seconds.  Major exchange and Tether operator, Bitfinex, has imposed a temporary ban on all fiat deposits. Clients are no longer able to deposit Euros, Dollars, Yen or Pounds to the exchange. Withdrawals are reportedly working normally. Bitfinex has sa</media:description>
			<media:thumbnail url="https://99bitcoins.com/wp-content/uploads/2018/10/zc27ufwgczo.jpg" />
			<media:keywords></media:keywords>
		</media:content>

FeedKit can parse media:content with attributes, but can't parse inside media:content. How I can extend your parser and don't touch your code or maybe you add it?

I use CocoaPods, So I can't change your source code locally.

Maybe you can give a full block of XML and each developer can parse it, if it's not standard.

Thanks
Best Regards

Custom Attributes + CDATA Encoding

I apologize if this question is easily solvable,

In my XML document I have a custom attribute dc:creator (which specifies the author) that is also encoded in CDATA. I was wondering how I would use FeedKit with custom attributes and when they're encoded in CDATA.

Variable used within it's own initial value

The URL variable definition in the example provided in the README file should be lowercased, not to clash with the URL class name.

This:

let URL = URL(string: "http://images.apple.com/main/rss/hotnews/hotnews.rss")!

Should be:

let url = URL(string: "http://images.apple.com/main/rss/hotnews/hotnews.rss")!

How to exted RSS feed with custom tags?

I have specific tags in a feed adn I want to exted "RSSPath" enum and "RSSFeed + Attributes Mapper" according to my requirements. My tags aren't confirm to RSS 2.0 specifications. How I can do it easily without modifying source files? Is there any other ways?

Atom feed entry summary with encoded HTML entity is lost

The XKCD atom feed at http://xkcd.com/atom.xml contains summaries like:
<summary type="html">&lt;img src="http://imgs.xkcd.com/comics/soda_sugar_comparisons.png" title="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles." alt="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles." /&gt;</summary>
Note the HTML encoded "<" and ">" of the HTML content's img tag.

The "foundCharacters" XMLParser delegate callback gets called three times for this (I don't know if that is a bug in XMLParser or expected behavior):

  1. "<"
  2. "img src="http://imgs.xkcd.com/comics/soda_sugar_comparisons.png\" title="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles." alt="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles." /"
  3. ">"

Expected: This should go together into AtomFeedEntrySummary as "<img src="http://imgs.xkcd.com/comics/soda_sugar_comparisons.png\" title="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles." alt="The key is portion control, which is why I've switched to eating smaller cans of frosting instead of full bottles.">"

Acutal: AtomFeedEntrySummary is nil

Operation queue, cancel

Hi, I've question.

How I can use this library with NSOperationQueue and is there any way to cancel FeedKit parse request.
is the XMLParser's abortParsing method appropriate for that?

Crashes when feed url returns html

OK I am using pod 6

sometimes this url: http://www.newsbtc.com/feed/

will return HTML and quickly crash 👍

        FeedParser(URL: feedURL)!.parseAsync { (result) in

Normall it returns an RSS feed but through my testing it will block too many transactions and return HTML saying you need to talk to support.

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.