Remove unnecessary bluebird dependency
This commit is contained in:
parent
b87476abc9
commit
42b6cd5a32
9 changed files with 10437 additions and 231 deletions
|
@ -1,6 +1,5 @@
|
|||
import { parse } from 'url';
|
||||
import request from 'superagent';
|
||||
import 'superagent-bluebird-promise';
|
||||
import debuglog from 'debug';
|
||||
import urlMatch from './url';
|
||||
|
||||
|
@ -49,7 +48,7 @@ function looseMatch(needle, haystack, type, various) {
|
|||
export function* lookupId(id, type) {
|
||||
const path = `/${type}/${id}?size=xl`;
|
||||
|
||||
const { body } = yield request.get(apiRoot + path).promise();
|
||||
const { body } = yield request.get(apiRoot + path);
|
||||
if (!body || body.error) {
|
||||
const error = new Error('Not Found');
|
||||
error.status = 404;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { parse } from 'url';
|
||||
import querystring from 'querystring';
|
||||
import request from 'superagent';
|
||||
import 'superagent-bluebird-promise';
|
||||
import urlMatch from './url';
|
||||
|
||||
const apiRoot = 'https://itunes.apple.com';
|
||||
|
|
|
@ -3,7 +3,6 @@ import querystring from 'querystring';
|
|||
import request from 'superagent';
|
||||
import Nodebrainz from 'nodebrainz';
|
||||
import { toSeconds, parse as ptParse } from 'iso8601-duration';
|
||||
import 'superagent-bluebird-promise';
|
||||
import debuglog from 'debug';
|
||||
import urlMatch from './url';
|
||||
|
||||
|
@ -30,7 +29,7 @@ const apiRoot = 'https://www.googleapis.com/youtube/v3';
|
|||
export function* lookupId(id) {
|
||||
const path = `/videos?part=snippet%2CcontentDetails&id=${id}&key=${credentials.key}`;
|
||||
try {
|
||||
const result = yield request.get(apiRoot + path).promise();
|
||||
const result = yield request.get(apiRoot + path);
|
||||
const item = result.body.items[0].snippet;
|
||||
|
||||
const duration = toSeconds(ptParse(result.body.items[0].contentDetails.duration));
|
||||
|
@ -85,7 +84,7 @@ export function* search(data) {
|
|||
}
|
||||
|
||||
const path = `/search?part=snippet&q=${encodeURIComponent(query)}&type=video&videoCaption=any&videoCategoryId=10&key=${credentials.key}`;
|
||||
const result = yield request.get(apiRoot + path).promise();
|
||||
const result = yield request.get(apiRoot + path);
|
||||
const item = result.body.items[0];
|
||||
|
||||
if (!item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue