-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
43 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
import youtube from './youtub.js' | ||
import dao from '../youtubeDao.js' | ||
import channels from '../channels.js' | ||
|
||
async function getChannelInfo(channelId) { | ||
try { | ||
const response = await youtube.channels.list({ | ||
id: channelId, | ||
part: 'snippet,contentDetails', // 필요한 정보를 지정합니다. | ||
}) | ||
const items = response.data.items[0] | ||
const data = { | ||
title: items.snippet.title, | ||
customUrl: items.snippet.customUrl, | ||
thumbnail: items.snippet.thumbnails.high.url, | ||
channelId: items.id, | ||
} | ||
return data | ||
} catch (error) { | ||
console.error('Error:', error) | ||
} | ||
} | ||
import cr from '../cron/cron-channel.js' | ||
|
||
// 채널 ID를 입력하여 실행합니다. | ||
channels.dev[0].forEach(async (channelId) => { | ||
const data = await getChannelInfo(channelId) | ||
const data = await cr.getChannelInfo(channelId) | ||
data.lang = 'ko' | ||
data.category = 'dev' | ||
dao.create(data) | ||
}) | ||
// 채널 ID를 입력하여 실행합니다. | ||
channels.dev[1].forEach(async (channelId) => { | ||
const data = await getChannelInfo(channelId) | ||
const data = await cr.getChannelInfo(channelId) | ||
data.lang = 'en' | ||
data.category = 'dev' | ||
dao.create(data) | ||
}) | ||
|
||
cr.findChannelInfo('@kenuheo') |
This file contains 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
This file contains 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