Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FitUrRing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wss9
FitUrRing
Commits
048a6fbd
Commit
048a6fbd
authored
6 months ago
by
다인 김
Browse files
Options
Downloads
Patches
Plain Diff
Delete fetchVideoLength.js
parent
993a0c8e
No related branches found
No related tags found
1 merge request
!44
Feat/router
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
back/src/utils/fetchVideoLength.js
+0
-25
0 additions, 25 deletions
back/src/utils/fetchVideoLength.js
with
0 additions
and
25 deletions
back/src/utils/fetchVideoLength.js
deleted
100644 → 0
+
0
−
25
View file @
993a0c8e
require
(
'
dotenv
'
).
config
();
const
ptToSeconds
=
require
(
'
./utils/timeconvert
'
);
async
function
fetchVidLength
(
videoId
)
{
try
{
const
response
=
await
fetch
(
`https://www.googleapis.com/youtube/v3/videos?part=contentDetails,statistics,snippet&id=
${
videoId
}
&key=
${
process
.
env
.
YOUTUBE_API_KEY
}
`
);
const
data
=
await
response
.
json
();
let
video_length
=
data
.
items
[
0
].
contentDetails
.
duration
;
let
video_likes
=
data
.
items
[
0
].
statistics
.
likeCount
;
video_length
=
ptToSeconds
(
video_length
);
let
channel_title
=
data
.
items
[
0
].
snippet
.
channelTitle
;
return
{
videoLength
:
video_length
,
videoLikes
:
video_likes
,
channelTitle
:
channel_title
,
};
}
catch
(
err
)
{
console
.
error
(
'
Error during API details request;
'
,
err
);
return
null
;
}
}
module
.
exports
=
fetchVidLength
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment