Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/videos.js
Last active Nov 9, 2018

Embed
What would you like to do?
Youtube in React: parse related videos response
function reduceRelatedVideosRequest(responses) {
const relatedVideosResponse = responses.find(r => r.result.kind === SEARCH_LIST_RESPONSE);
const {pageInfo, items, nextPageToken} = relatedVideosResponse.result;
const relatedVideoIds = items.map(video => video.id);
return {
totalResults: pageInfo.totalResults,
nextPageToken,
items: relatedVideoIds
};
}
export const SEARCH_LIST_RESPONSE = 'youtube#searchListResponse';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.