Skip to content

Commit 8a3b045

Browse files
committed
docs: Update README with v2 installation instructions
- Add Installation section with go get command for v2 - Update import paths to use /v2 suffix - Add import statements to code examples - Make it clear how to import the main package and feed-specific parsers
1 parent 9d62326 commit 8a3b045

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
## Table of Contents
1313
- [Features](#features)
14+
- [Installation](#installation)
1415
- [Overview](#overview)
1516
- [Basic Usage](#basic-usage)
1617
- [Advanced Usage](#advanced-usage)
@@ -42,6 +43,28 @@ For added convenience, gofeed includes native support for parsing certain well-k
4243

4344
- Dublin Core: Accessible via `Feed.DublinCoreExt` and `Item.DublinCoreExt`
4445
- Apple iTunes: Accessible via `Feed.ITunesExt` and `Item.ITunesExt`
46+
47+
## Installation
48+
49+
```bash
50+
go get github.com/mmcdole/gofeed/v2
51+
```
52+
53+
Import in your code:
54+
55+
```go
56+
import "github.com/mmcdole/gofeed/v2"
57+
```
58+
59+
For feed-specific parsers:
60+
61+
```go
62+
import (
63+
"github.com/mmcdole/gofeed/v2/rss"
64+
"github.com/mmcdole/gofeed/v2/atom"
65+
"github.com/mmcdole/gofeed/v2/json"
66+
)
67+
```
4568

4669
## Overview
4770

@@ -66,6 +89,11 @@ Here's how to parse feeds using `gofeed.Parser`:
6689

6790
#### From a URL
6891
```go
92+
import (
93+
"fmt"
94+
"github.com/mmcdole/gofeed/v2"
95+
)
96+
6997
fp := gofeed.NewParser()
7098
feed, _ := fp.ParseURL("http://feeds.twit.tv/twit.xml")
7199
fmt.Println(feed.Title)
@@ -120,6 +148,11 @@ If you have a usage scenario that requires a specialized parser:
120148
#### RSS Feed
121149

122150
```go
151+
import (
152+
"strings"
153+
"github.com/mmcdole/gofeed/v2/rss"
154+
)
155+
123156
feedData := `<rss version="2.0">
124157
<channel>
125158
<webMaster>example@site.com (Example Name)</webMaster>

0 commit comments

Comments
 (0)