Skip to content

Instantly share code, notes, and snippets.

@fantasywind
Created April 25, 2021 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fantasywind/9dc90852a9b2700439f3d6f2eaa9e943 to your computer and use it in GitHub Desktop.
Save fantasywind/9dc90852a9b2700439f3d6f2eaa9e943 to your computer and use it in GitHub Desktop.
const YOUTUBE_DATA = {
kind: 'youtube#videoListResponse',
etag: 'QOJsG51Qlpq5TNrbq6faaKRqYg8',
items: [
{
kind: 'youtube#video',
etag: '5vsH01N8zX_GwP5J3tGFDlFmBRs',
id: 'E_hmPwk37ME',
snippet: {
publishedAt: '2020-10-02T13:00:10Z',
channelId: 'UCfanbLlFn7EB5fiJuR2Kmhw',
title: '魏如昀|queenwei《他們說我是沒有用的年輕人/好樂團》unplugged cover #6',
description: '一把吉他,一個我,一首歌,唱給你聽。\n\n/\n\n「你會不會和我一樣,把希望寄託在別人的身上。」\n__ 他們說我是沒用的年輕人(好樂團)。\n\n人生會為你找到各種出路,但環境不會。\n未來的你會幫助現在的你有各種解決和面對的方法,但環境不會。\n但環境會讓你以為一切都是因為這個環境。\n\n尼采說過,生命中最難的階段不是沒有人懂你,而是你不懂你自己。\n不管你什麼才開始懂你自己,至少你懂。\n\n只要開始,就不算晚。\n\n/\n\n#queenwei #guitarcover #cover #unplugged #acoustic #practice \n#acousticguitar #ag #sing #originalsound #filminonetake #onetake \n#唱得我聲嘶力竭 #他們說我是沒有用的年輕人 #好樂團 #魏如昀 \n#不插電 #木吉他 #原音 #一鏡到底',
thumbnails: {
default: {
url: 'https://i.ytimg.com/vi/E_hmPwk37ME/default.jpg',
width: 120,
height: 90
},
medium: {
url: 'https://i.ytimg.com/vi/E_hmPwk37ME/mqdefault.jpg',
width: 320,
height: 180
},
high: {
url: 'https://i.ytimg.com/vi/E_hmPwk37ME/hqdefault.jpg',
width: 480,
height: 360
},
standard: {
url: 'https://i.ytimg.com/vi/E_hmPwk37ME/sddefault.jpg',
width: 640,
height: 480
},
maxres: {
url: 'https://i.ytimg.com/vi/E_hmPwk37ME/maxresdefault.jpg',
width: 1280,
height: 720
}
},
channelTitle: '魏如昀 [QueenWei Official]',
categoryId: '22',
liveBroadcastContent: 'none',
localized: {
title: '魏如昀|queenwei《他們說我是沒有用的年輕人/好樂團》unplugged cover #6',
description: '一把吉他,一個我,一首歌,唱給你聽。\n\n/\n\n「你會不會和我一樣,把希望寄託在別人的身上。」\n__ 他們說我是沒用的年輕人(好樂團)。\n\n人生會為你找到各種出路,但環境不會。\n未來的你會幫助現在的你有各種解決和面對的方法,但環境不會。\n但環境會讓你以為一切都是因為這個環境。\n\n尼采說過,生命中最難的階段不是沒有人懂你,而是你不懂你自己。\n不管你什麼才開始懂你自己,至少你懂。\n\n只要開始,就不算晚。\n\n/\n\n#queenwei #guitarcover #cover #unplugged #acoustic #practice \n#acousticguitar #ag #sing #originalsound #filminonetake #onetake \n#唱得我聲嘶力竭 #他們說我是沒有用的年輕人 #好樂團 #魏如昀 \n#不插電 #木吉他 #原音 #一鏡到底'
}
}
}
],
pageInfo: {
totalResults: 1,
resultsPerPage: 1
}
};
const Fastify = require('fastify');
const axios = require('axios');
const fastify = Fastify({
logger: true,
bodyLimit: 1024857600,
});
fastify.post('/', (request, reply) => {
console.timeEnd('JSON:Transmission');
reply.send({ done: true });
});
fastify.listen(3000, async () => {
const body = JSON.stringify(YOUTUBE_DATA);
console.time('JSON:Transmission');
axios({
method: 'post',
url: 'http://127.0.0.1:3000',
data: body,
responseType: 'json',
headers: {
'Content-Type': 'application/json',
},
maxBodyLength: Infinity,
}).then(({ data }) => {
console.time('JSON:Serialize');
console.log(`JSON:Size:${Buffer.from(JSON.stringify(YOUTUBE_DATA), { encoding: 'utf8' }).length}`);
console.timeEnd('JSON:Serialize');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment