From ed2981f545dc0fa97bb90ae7108e2072919c3e82 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 5 Jan 2014 11:54:59 +0100 Subject: Rewrite GUID. Perhaps this will fix false new entries in the feed reader... --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index b6842ce..e01a43a 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "io" "net/http" "os" + "regexp" "strings" ) @@ -91,6 +92,8 @@ func getLatestVideos(ytChan string, itemChan chan<- Item, status chan<- error) { status <- err } +var vidID = regexp.MustCompile(`v=(.*?)&`) + func main() { subs, err := subscribedTo() if err != nil { @@ -105,6 +108,11 @@ func main() { go func() { for it := range itemChan { it.Title = fmt.Sprintf("[%s] %s", it.Author, it.Title) + + if m := vidID.FindStringSubmatch(it.Link); len(m) == 2 { + it.GUID = "video:" + m[1] + } + items = append(items, it) } }() -- cgit v1.2.3-54-g00ecf