2015-08-20 23:22:57 +01:00
|
|
|
import { parse } from 'url';
|
|
|
|
import querystring from 'querystring';
|
|
|
|
import request from 'superagent';
|
|
|
|
import 'superagent-bluebird-promise';
|
2015-01-12 17:38:42 +00:00
|
|
|
|
2015-08-20 23:22:57 +01:00
|
|
|
const credentials = {
|
2015-01-12 17:38:42 +00:00
|
|
|
key: process.env.YOUTUBE_KEY,
|
|
|
|
};
|
|
|
|
|
2015-08-21 18:33:50 +01:00
|
|
|
const apiRoot = 'https://www.googleapis.com/freebase/v1/topic';
|
2015-01-12 17:38:42 +00:00
|
|
|
|
2015-08-20 23:22:57 +01:00
|
|
|
export function* get(topic) {
|
2015-08-21 18:33:50 +01:00
|
|
|
const result = yield request.get(apiRoot + topic + '?key=' + credentials.key).promise();
|
2015-08-20 23:22:57 +01:00
|
|
|
return result.body;
|
2015-01-12 17:38:42 +00:00
|
|
|
}
|