Created
November 30, 2015 04:24
-
-
Save karlbright/925e70aa3dfa30a3ee81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'isomorphic-fetch' | |
import QS from 'qs' | |
const URL_PREFIX = 'https://www.googleapis.com/youtube/v3' | |
const PLAYLIST_ID = 'UUANLZYMidaCbLQFWXBC95Jg' | |
const API_KEY = 'XXX' | |
const DEFAULT_PART = 'contentDetails' | |
const DEFAULT_MAX_RESULTS = '50' | |
function buildUrl(path, params) { | |
params = QS.stringify(Object.assign({}, { part: DEFAULT_PART, key: API_KEY }, params)) | |
return URL_PREFIX + path + '?' + params | |
} | |
export function videos (playlistId) { | |
fetch(buildUrl('/playlistItems', { playlistId })) | |
.then(response => console.log(response)) | |
} | |
videos(PLAYLIST_ID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment