Coder Social home page Coder Social logo

go-rss's Introduction

RSS 2.0 Parser

Go Go Report Card GoDoc

Requirements

Golang 1.13+, 1.14+

Getting It

You can get go-rss by using

$ go get -u github.com/kostya-ten/go-rss

Parse rss file

  import "github.com/kostya-ten/go-rss"

  func main() {
    feed, err := rss.ParseFile(filename)
    if err != nil {
      panic(err)
    }

    title := feed.Channel.Title
    fmt.Println(title)
  }

Parse rss url

  import "github.com/kostya-ten/go-rss"

  func main() {
    feed, err := rss.ParseURL("http://static.userland.com/gems/backend/rssTwoExample2.xml", &http.Client{})
    if err != nil {
      panic(err)
    }

    title := feed.Channel.Title
    fmt.Println(title)
  }

Bulk parse rss url

  import "github.com/kostya-ten/go-rss"

  func main() {
    urls := []string{
      "https://lenta.ru/rss",
      "https://www.interfax.ru/rss.asp",
      "https://ria.ru/export/rss2/index.xml",
      "http://static.feed.rbc.ru/rbc/logical/footer/news.rss",
      "http://tass.ru/rss/v2.xml",
      "https://www.vesti.ru/vesti.rss",
    }

    resultRss := rss.ParseBulk(urls, &http.Client{}, &BulkOptions{maxgoroutine: 10, buffer_chan: 10})
    for _, v := range resultRss {
      fmt.Println(v.Channel.Title)
    }
  }

go-rss's People

Contributors

kostyaten avatar

Stargazers

 avatar  avatar  avatar

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.