Skip to content

Commit

Permalink
Create readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gentildpinto authored Oct 12, 2024
1 parent f3c9fff commit da5f112
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# rss2go

`rss2go` is a Go package designed to fetch and parse RSS feeds. It provides a simple API to request RSS data from a URL and unmarshals the XML content into Go structs.

## Features

- Fetches RSS feeds via HTTP requests
- Parses and unmarshals RSS feed data from XML into Go structs
- Supports media content in RSS feed items
- Handles common RSS formats including Atom links
- Cleans up CDATA tags from the response

## Installation

To use `rss2go`, you need to have Go installed. You can install the package with the following command:

```bash
go get github.com/gentildpinto/rss2go
```

## Usage

Import the package in your Go project and call the Rss2Go function to fetch and parse an RSS feed:

```go
package main

import (
"fmt"
"log"

"github.com/gentildpinto/rss2go"
)

func main() {
feedUrl := "https://example.com/rss"
feed, err := rss2go.Rss2Go(feedUrl)
if err != nil {
log.Fatalf("Error fetching feed: %v", err)
}

fmt.Println("Feed Title:", feed.Channel.Title)
for _, item := range feed.Channel.Items {
fmt.Printf("Title: %s\nLink: %s\n", item.Title, item.Link)
}
}
```

## Structs

The following Go structs are used to represent the structure of an RSS feed:

- **Feed**: The root RSS element.
- **Channel**: Contains metadata about the RSS feed.
- **Item**: Represents each entry in the feed.
- **Image**: Optional image metadata for the feed.
- **MediaContent**: Represents media content (if any) in an item.
- **AtomLink**: Used for Atom feed compatibility.

## Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue if you encounter any bugs or have suggestions for new features.

<!--License
This project is licensed under the MIT License. See the LICENSE file for details.-->

0 comments on commit da5f112

Please sign in to comment.