This commit is contained in:
NK 2023-04-27 15:23:04 +01:00
parent ecf1d45af8
commit 4d1c6e892f
4 changed files with 10 additions and 9 deletions

BIN
public/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View file

@ -28,3 +28,9 @@ export default async function handler(
res.status(405).json({ message: "Method not allowed", code: 405 });
}
}
export const config = {
api: {
responseLimit: false,
},
};

View file

@ -9,16 +9,13 @@ export default function Home() {
const getTitle = async (videoID: string) => {
const youtubeAPI = `https://www.googleapis.com/youtube/v3/videos?part=snippet&id=${videoID}&fields=items(id%2Csnippet)&key=AIzaSyB8Fk-MWT_r8nVgG35gIZoP-DhJYpJ_tZ0`;
let response = await fetch(youtubeAPI);
const res = await response.json();
const title = res.items[0].snippet.title;
return title;
const response = await fetch(youtubeAPI).then(res => res.json());
return response.items[0].snippet.title;
};
const getVideoID = (url: string) => {
if (url.match(/watch/)) {
const videoID = url.split("/")[3].split("?")[1].split("=")[1];
return videoID;
return url.split("/")[3].split("?")[1].split("=")[1];
} else if (url.match(/youtu.be/)) {
const videoID = url != "" && url.split("/")[3];
return videoID;
@ -39,7 +36,6 @@ export default function Home() {
.then(res => res.blob())
.then(blob => {
const sizeInBytes = blob.size;
console.log("sizeInBytes: ", sizeInBytes);
if (sizeInBytes <= 0) {
setInfo(
"Unable to download! Maybe File size is too high. Try to download video less than 5MB"

View file

@ -1,6 +1,5 @@
module.exports = {
purge: ["./src/pages/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
darkMode: false, // or 'media' or 'class'
purge: ["./src/pages/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},