 import SwiftyJSON
 import NXOAuth2Client
 import MusicFeeder
+import OAuthSwift
+import Prephirences
 
 extension XCDYouTubeClient {
     func fetchVideo(_ identifier: String) -> SignalProducer<XCDYouTubeVideo, NSError> {

            let url = "https://www.googleapis.com/youtube/v3/guideCategories"
            var params: [String: Any]
            if let token = pageToken {
                params = ["key": self.API_KEY
                    , "part": "snippet", "maxResults": 10, "regionCode": "JP", "pageToken": token]
            } else {
                params = ["key": self.API_KEY, "part": "snippet", "maxResults": 10, "regionCode": "JP"]
            }

            let request = self.request(url, method: .get, parameters: params, encoding: URLEncoding.default) { response in


    func fetch<T: YouTubeResource>(_ params: [String:String]) -> SignalProducer<(items: [T], nextPageToken: String?), NSError> {
        return SignalProducer { (observer, disposable) in
            var _params: [String: Any] = ["part": "snippet",
                                    "maxResults": 10]
            for k in params.keys {
                _params[k] = params[k] as AnyObject?
            }
            if !YouTubeAPIClient.isLoggedIn {
                _params["key"] = self.API_KEY
            }
            let request = self.request(T.url, method: .get, parameters: _params, encoding: URLEncoding.default) { response in
                if let e = response.result.error {
