Git Product home page Git Product logo

webfeed's Introduction

WebFeed

Build Status Pub

A dart package for parsing RSS and Atom feed.

Features

  • RSS (0.9, 1.0, & 2.0)
  • Atom
  • Namespaces
    • Media RSS
    • Dublin Core
    • iTunes
    • Syndication

Installing

Add this line into your pubspec.yaml

webfeed: ^0.7.0

Import the package into your dart code using:

import 'package:webfeed/webfeed.dart';

Example

To parse string into RssFeed object use:

var rssFeed = RssFeed.parse(xmlString); // for parsing RSS feed
var atomFeed = AtomFeed.parse(xmlString); // for parsing Atom feed

Preview

RSS

feed.title
feed.description
feed.link
feed.author
feed.items
feed.image
feed.cloud
feed.categories
feed.skipDays
feed.skipHours
feed.lastBuildDate
feed.language
feed.generator
feed.copyright
feed.docs
feed.managingEditor
feed.rating
feed.webMaster
feed.ttl
feed.dc

RssItem item = feed.items.first;
item.title
item.description
item.link
item.categories
item.guid
item.pubDate
item.author
item.comments
item.source
item.media
item.enclosure
item.dc

Atom

feed.id
feed.title
feed.updated
feed.items
feed.links
feed.authors
feed.contributors
feed.categories
feed.generator
feed.icon
feed.logo
feed.rights
feed.subtitle

AtomItem item = feed.items.first;
item.id
item.title
item.updated
item.authors
item.links
item.categories
item.contributors
item.source
item.published
item.content
item.summary
item.rights
item.media

License

WebFeed is licensed under the MIT License - see the LICENSE.md file for details

webfeed's People

Contributors

alexandergottlieb avatar comlaterra avatar kalela avatar magodo avatar matthew-carroll avatar nonameden avatar pdahlberg avatar witochandra 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

webfeed's Issues

Null Safety

Can we get a version of the package that has null safety enabled?

Add support for media:content url

I am working with an RSS feed :

https://weworkremotely.com/categories/remote-programming-jobs.rss

I am not able to get the url of this GIF.

      <media:content url="https://wwr-pro.s3.amazonaws.com/logos/0018/2781/logo.gif" type="image/png"/>

I tried various things such as item.media.group.content.attributes.url, but there doesn't seem to be a feature to support this!

This is my Code:

 return ListView.builder(
      itemCount: _feed.items.length,
      itemBuilder: (BuildContext context, int index) {
        final item = _feed.items[index];
        return ListTile(
          title: title(item.title),
          subtitle: subtitle(item.pubDate.toString()),
          leading: thumbnail(item.media.group.content.attributes.url),
          trailing: rightIcon(),
          contentPadding: EdgeInsets.all(5.0),
          onTap: () => openFeed(item.link),
        );
      },
    );

It would be great, if this feature is added!

StateError (Bad state: No element)

Hello, I'm trying to parse https://videogamezone.eu/feed.xml but it returns StateError (Bad state: No element) both with RssFeed and AtomFeed
Here is the function I'm using rn:

Future<AtomFeed> loadFeed() async {
    final client = http.Client();
    final response = await client.get(FEED_URL);
    print(response.body);
    return AtomFeed.parse(response.body);
}

PubDate

Please, back pubDate to accept string instead DateTime! Some feeds has stranges formats dates and DateTime is not able to convert these ones.

XML Version Support

Please update to the latest version of the xml package.
Version 5.4.1 is a bit out of date.

Basically, we just need this PR to get merged => #63

No "enclosure" tag supported

Hi, I'm trying to parse a Podcast RSS feed that uses <enclosure> tags to define the URL that hosts the MP3 file. As far as I can tell there is no support for that tag in webfeed. Is there any particular reason why?

dart 2

please make compatible for dart 2

not working

I tried your sample code in my main.dart and it's not working. Getting at the below core dart file at findAllElements() call step .......
I've below SDK config in my pubsync ...is this plugin compatible with Dart 2.0 ?

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"

import 'dart:core';

import 'package:xml/xml.dart';

XmlElement findElementOrNull(XmlElement element, String name) {
  try {
    return element.findAllElements(name).first;
  } on StateError {
    return null;
  }
}

Exception with few atom feeds

Im getting

Another exception was thrown: Invalid argument(s): source must be a String or List<int> (of bytes). You can also pass a RandomAccessFile if you import package:html/parser_console.dart  and call useConsole().```


While parsing some feedburner feeds. For example `http://niebezpiecznik.pl/feed`

A more complete example?

I in the process of learning flutter and would really really (*5) appreciate
a more complete example of a simple rss to "Card" or anything similar.

I searched but couldnt find anything other than the actual final code.
Any chance of such an example in the near future?

Please add Group attributes for Youtube Feed

For rss feeds with <media: thumbnails> there is no compatibility.
Can you add the following attributes to group.dart?

  • title,
  • contents,
  • thumbnails,
  • description,
  • community,
  • credits,
  • category,
  • rating,

thanks

StateError (Bad state: No element)

This code returns an exception on the last line

    /// Load data from RSS Feed
 		Client client = Client();
		Response response = await client.get("https://www.apple.com/newsroom/rss-feed.rss");
		RssFeed channel;
		String rssXml = response.body;

		channel = RssFeed.parse(rssXml);

image

Flutter doc

[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.18908.1000], locale en-US)
    • Flutter version 1.5.4-hotfix.2 at C:\Tools\flutter
    • Framework revision 7a4c33425d (6 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Tools\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Tools\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)        
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] Connected device (1 available)
    • ONEPLUS A6013 • afa09d33 • android-arm64 • Android 9 (API 28)

• No issues found!```

Only printing "Instance of 'RssFeed'"

I tried your example, but the only thing that prints to the console is "Instance of 'RssFeed'" or "Instance of 'AtomFeed'". Depending on if i use the Rss or Atom example

Add support for media:thumbnail within channel

Hi, would you mind adding support for a "media:thumbnail" entry within the tag?

Here is an example:

<channel>
    ...
    <media:thumbnail url="http://storage.googleapis.com/androiddevelopers/android_developers_backstage/adb.png"/>
    ...
</channel>

Also, you might consider offering an escape hatch in your API so that developers can look up tags that either don't fit the spec, or tags that you haven't had a chance to expose yet.

Resolving dependencies fail

Hi today with the new Flutter version webfeed fail :(

Because webfeed >=0.5.0 depends on intl ^0.16.0 and every version of flutter_localizations from sdk depends on intl 0.17.0, webfeed >=0.5.0 is incompatible with flutter_localizations from sdk.
So, because oci_balance_app depends on both flutter_localizations any from sdk and webfeed ^0.6.0, version solving failed.
pub get failed (1; So, because oci_balance_app depends on both flutter_localizations any from sdk and webfeed ^0.6.0, version solving failed.)

RssItem optional content:encoded

Its possible to the RssItem have a optional encoded parameter when finding the content element?
I had a problem to get the content from the blog of the companie client. The content of the blog was returning null every time, then i figure out was the content:encoded in the RssItem, i had to extends some classes to remove the content:encoded from RssItem class, after this the content was returning correctly.

UTF-8 and Date Format

Hi, is it possible to convert the title and body of a RSS to UTF-8 and is is possible to change the date format to e.g. DD/MM/YYYY hh:mm?

Screenshot 2020-05-02 at 20 21 45

Screenshot 2020-05-02 at 20 21 51

XenForo <dc:creator> tag

Hey there again,

is there a possibility to get the dc:creator tag from a rss feed?

<item>
      <title>Cookies!</title>
      <pubDate>Sat, 25 Aug 2018 16:46:06 +0000</pubDate>
      <link>*****</link>
      <guid>****</guid>
      <author>[email protected] (Nico_DreamzZ)</author>
      <dc:creator>Nico_DreamzZ</dc:creator>
      <content:encoded><![CDATA[Cookies are awesome....]]></content:encoded>
    </item>

Thanks for your time supporting this!

Depends on webfeed any which requires SDK version >=1.8.0 <2.0.0, version solving failed

This library needs an update to support the new Dart SDK version, it would be nice to upgrade it.

/.../SDK/Flutter/flutter/bin/flutter --no-color packages upgrade
Running "flutter packages upgrade" in app...
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because app depends on webfeed any which requires SDK version >=1.8.0 <2.0.0, version solving failed.
pub upgrade failed (1)
Process finished with exit code 1

Thank you very much

Problems with UTF-8 encoding

I built an RSSReader to get some news from a german news television shows RSS feed, and since its german it has some special characters in it (äüöÄÜÖ) and those get picked up wrong by the UTF-8 encoding:

All of the german special characters get somehow replaced by Ä and some garbage cause the translator adds 2 UTS-8 bytes (dez. 131 & 164) behind the 165 byte which indicates the german and some other special characters.

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.