Git Product home page Git Product logo

feed-user's Introduction

Introduction

This package has for objective to help RSS feeds' users to handle them. Atom links are not handled yet.

BE CAREFUL !! This project was made within a school project. Maintainance may not be punctual.

Installation

npm install feed-user

Usage

var feedu = require('feed-user');

var urls = [
    "https://stackoverflow.com/feeds",
    "http://feeds.bbci.co.uk/news/rss.xml"
];

urls.forEach(url => {
    //Main function
    feedu.fetchRSS(url, (feed) => {
        for (let i = 0; i < feed.length; i++) {
            console.log(feed[i].title, feed[i].link);
        }
        var itemsArray = feed;
    })
    //Overwrite a JSON file
    .feedOverwriteJSON(itemsArray, PATH_TO_FILE, enableTodaysDateNaming)
    //or append to an existing one !
    .feedAppendJSON(itemsArray, PATH_TO_FILE);
});

//Gathers html file from link (experimental)
feedu.getArticle(itemsArray[3].link);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

BE AWARE : I am not an expert, still studying toughly, and stay in love of Node.js. This may not be the quality you expected. I apologize for all disagreements.

License

MIT

feed-user's People

Contributors

kvntn avatar

Watchers

 avatar

feed-user's Issues

ENOENT: no such file or directory

var FEED_LOCAL_PATH = "/feeds/";
...
feedu.feedAppendJSON(itemsArray, FEED_LOCAL_PATH + timestampString);

The function createPath does not create path to file.

feedu.createPath = (path) => {

    _path = path.split('/');

    if (!fs.existsSync(_path)) {
        let part = '.';
        for (let i = 1; i < _path.length; i++) {
            if (process.platform === "win32")
                part += "\\" + _path[i];
            else
                part += "/" + _path[i];
            console.log("Created folder : " + __dirname + part);
            if (!fs.existsSync(part)) {
                mkdirp(part);
            }
        }
    }
};

The function is executed within the function feedOverwriteJSON. As said, it does not create folders to complete the path and returns me an error while doing fs.writeFileSync(path, _jbuff.stringify, 'utf8');

ENOENT: no such file or directory (dir path)\feeds\May_13_2020.json

check feed-user.js if you want to take a look at it :)

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.