summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feed/feed.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/feed/feed.go b/feed/feed.go
index b20a281..3f82096 100644
--- a/feed/feed.go
+++ b/feed/feed.go
@@ -105,3 +105,20 @@ func nprUnmarshal(bs []byte) (schema.NPRFeed, error) {
return *nprFeed, nil
}
+// Unmarshal a YouTube feed.
+func youtubeUnmarshal(bs []byte) (schema.YouTubeFeed, error) {
+ ytFeed := new(schema.YouTubeFeed)
+ err := xml.Unmarshal(bs, ytFeed)
+ if err != nil {
+ return *ytFeed, err
+ }
+
+ // Parse time for all entries.
+ for i, entry := range ytFeed.Entries {
+ ytFeed.Entries[i].PubTime, err = time.Parse(time.RFC3339, entry.Pub)
+ if err != nil {
+ return *ytFeed, err
+ }
+ }
+ return *ytFeed, nil
+}