8000 GitHub - benjaminheng/rsser
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

benjaminheng/rsser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSSer

GoDoc

RSSer allows you to generate RSS feeds for services that don't normally provide RSS feeds.

Currently RSSer supports the following sites:

  • Instagram

Contributions for additional sites are welcome!

Usage

Here's a minimal service that exposes RSS feeds for Instagram users.

package main

import (
	"context"
	"log"
	"net/http"

	"github.com/benjaminheng/rsser/instagram"
	"github.com/gorilla/mux"
)

func main() {
	r := mux.NewRouter()
	r.HandleFunc("/feed/instagram/user/{username}", InstagramFeedHandler)
	log.Println("Server listening on :8000")
	log.Fatal(http.ListenAndServe(":8000", r))
}

func InstagramFeedHandler(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	username := vars["username"]
	feed, err := instagram.GetUserFeed(context.Background(), username)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		w.Write([]byte(err.Error()))
		return
	}
	rss, err := feed.ToRss()
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		w.Write([]byte(err.Error()))
		return
	}
	w.WriteHeader(http.StatusOK)
	w.Write([]byte(rss))
}

See also: cmd/server/main.go.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0