README.md 1.69 KB
Newer Older
yPhil's avatar
yPhil committed
1
2
# Feedrat

yPhil's avatar
yPhil committed
3
*Search, find and report a web page's RSS feed(s)*
yPhil's avatar
yPhil committed
4
5
6

---

yPhil's avatar
yPhil committed
7
[![pipeline status](https://framagit.org/yphil/feedrat/badges/master/pipeline.svg)](https://framagit.org/yphil/feedrat/-/pipelines)
yPhil's avatar
yPhil committed
8
[![coverage](https://framagit.org/yphil/feedrat/badges/master/coverage.svg)](https://framagit.org/yphil/feedrat/-/pipelines)
yPhil's avatar
yPhil committed
9
[![website](https://img.shields.io/website?down_message=down&up_color=brightgreen&up_message=up&url=https%3A%2F%2Fpetrolette.space)](https://petrolette.space)
yPhil's avatar
yPhil committed
10
11
12
[![Liberapay](https://img.shields.io/liberapay/receives/yPhil?logo=liberapay)](https://liberapay.com/yPhil/donate)
[![Liberapay](https://img.shields.io/liberapay/goal/yPhil?logo=liberapay)](https://liberapay.com/yPhil/donate)
[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?label=buy+me+a&style=flat&logo=ko-fi&logoColor=white)](https://ko-fi.com/yphil/tiers)
yPhil's avatar
yPhil committed
13

yPhil's avatar
yPhil committed
14
15
## Features

yPhil's avatar
yPhil committed
16
Searches for XML feeds in a given URI using two strategies: usual suspects (url/feed, url/rss.xml, etc.) and DOM scraping in two places : The very URI, and then the domain thereof.
yPhil's avatar
yPhil committed
17

yPhil's avatar
yPhil committed
18
19
20
21
1. Parse the DOM of the URI for a link rel
2. Parse the DOM of root of the TLD for a link rel
3. Check the URI for usual suspects
4. Check the root of the TLD for usual suspects
yPhil's avatar
yPhil committed
22
23

And returns an array containing the URLs found.
yPhil's avatar
yPhil committed
24

yPhil's avatar
yPhil committed
25
26
27
28
## Installation

`npm install feedrat`

29
30
31
32
## Testing

`npm test`

yPhil's avatar
yPhil committed
33
34
## Usage

yPhil's avatar
yPhil committed
35
```javascript
yPhil's avatar
yPhil committed
36

yPhil's avatar
yPhil committed
37
const feedrat = require('feedrat');
yPhil's avatar
yPhil committed
38

yPhil's avatar
yPhil committed
39
feedrat('https://www.reddit.com/r/news', function(err, feeds) {
yPhil's avatar
yPhil committed
40

yPhil's avatar
yPhil committed
41
42
    if (feeds) {
        res.send(feeds)
yPhil's avatar
yPhil committed
43
    } else {
yPhil's avatar
yPhil committed
44
        res.status(500).send('No feed found')
yPhil's avatar
yPhil committed
45
    }
yPhil's avatar
yPhil committed
46

yPhil's avatar
yPhil committed
47
48
49
});

```
yPhil's avatar
yPhil committed
50

yPhil's avatar
yPhil committed
51
Brought to you ♫ by [yPhil](http://yphil.bitbucket.io/) Please consider ♥ [helping](https://liberapay.com/yPhil/donate) icon by Mattahan (Paul Davey)