https://github.com/peterhellberg/sr
Go library for Sveriges Radio API
https://github.com/peterhellberg/sr
Last synced: 12 months ago
JSON representation
Go library for Sveriges Radio API
- Host: GitHub
- URL: https://github.com/peterhellberg/sr
- Owner: peterhellberg
- Created: 2014-09-14T19:52:46.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-09T12:25:42.000Z (over 11 years ago)
- Last Synced: 2025-01-14T07:11:27.814Z (about 1 year ago)
- Language: Go
- Homepage: http://sverigesradio.se/api/documentation/v2/index.html
- Size: 387 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
sr (api v2)
==========
Go library for [Sveriges Radio API](http://sverigesradio.se/api/documentation/v2/index.html)
[](https://godoc.org/github.com/peterhellberg/sr)
[](https://travis-ci.org/peterhellberg/sr)
## Installation
```bash
go get -u github.com/peterhellberg/sr
```
## Example usage
Getting the toplist for the current day.
```go
package main
import (
"fmt"
"github.com/peterhellberg/sr"
)
func main() {
sr := sr.NewClient(nil)
shows, err := sr.Toplist.GetDay()
if err == nil {
for i, show := range shows {
fmt.Println(i+1, show.Title)
}
}
}
```
## Services
### Channels
Return a list of SR all channels
```go
package main
import (
"fmt"
"github.com/peterhellberg/sr"
)
func main() {
sr := sr.NewClient(nil)
if channels, err := sr.Channels.All(); err == nil {
for _, c := range channels {
fmt.Println(c.Name, "\n", c.SiteURL, "\n")
}
}
}
```
### Episodes
Get broadcast file for the latest episode of "Tankesmedjan"
```go
package main
import (
"fmt"
"github.com/peterhellberg/sr"
)
func main() {
sr := sr.NewClient(nil)
id := 3718
if e, err := sr.Episodes.GetLatest(id); err == nil {
fmt.Println(e.Broadcast.Broadcastfiles[0].URL)
}
}
```
### News
### Playlists
### Program Categories
### Programs
### Scheduled Episodes
### Sport
### Toplist
## Utils
Developed using [JSON-to-Go by](http://mholt.github.io/json-to-go/) by Matthew Holt.
## License
> *The MIT License (MIT)*
>
> Copyright (c) 2014 [Peter Hellberg](http://c7.se/)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.