Do not register SoundCloud/YouTube parsers if no auth details given for them.
parent
fb85ad8554
commit
19708251b9
26
main.go
26
main.go
|
@ -74,19 +74,27 @@ func main() {
|
||||||
m := manager.NewManager()
|
m := manager.NewManager()
|
||||||
|
|
||||||
// Load youtube parser
|
// Load youtube parser
|
||||||
youtubeParser := &youtube.Parser{
|
if len(youtubeApiKey) > 0 {
|
||||||
Config: &youtube.Config{ApiKey: youtubeApiKey},
|
youtubeParser := &youtube.Parser{
|
||||||
|
Config: &youtube.Config{ApiKey: youtubeApiKey},
|
||||||
|
}
|
||||||
|
must(m.RegisterParser(youtubeParser))
|
||||||
|
} else {
|
||||||
|
log.Println("No YouTube API key provided, YouTube parsing via API is disabled.")
|
||||||
}
|
}
|
||||||
must(m.RegisterParser(youtubeParser))
|
|
||||||
|
|
||||||
// Load soundcloud parser
|
// Load soundcloud parser
|
||||||
soundcloudParser := &soundcloud.Parser{
|
if len(soundcloudClientId) > 0 && len(soundcloudClientSecret) > 0 {
|
||||||
Config: &soundcloud.Config{
|
soundcloudParser := &soundcloud.Parser{
|
||||||
ClientId: soundcloudClientId,
|
Config: &soundcloud.Config{
|
||||||
ClientSecret: soundcloudClientSecret,
|
ClientId: soundcloudClientId,
|
||||||
},
|
ClientSecret: soundcloudClientSecret,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
must(m.RegisterParser(soundcloudParser))
|
||||||
|
} else {
|
||||||
|
log.Println("No SoundCloud client ID or secret provided, SoundCloud parsing via API is disabled.")
|
||||||
}
|
}
|
||||||
must(m.RegisterParser(soundcloudParser))
|
|
||||||
|
|
||||||
// Load wikipedia parser
|
// Load wikipedia parser
|
||||||
must(m.RegisterParser(new(wikipedia.Parser)))
|
must(m.RegisterParser(new(wikipedia.Parser)))
|
||||||
|
|
Loading…
Reference in New Issue