Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
chore: Remove logs and optimize syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjuaneight committed Nov 7, 2021
1 parent f1295d0 commit 3143288
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/airtable-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const airtableUpload = async (
body: JSON.stringify({
records: [
{
fields: {
...record,
},
fields: record,
},
],
}),
Expand Down
8 changes: 2 additions & 6 deletions src/bookmark-youtubes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ const cleanUrl = (url: string): YouTubeAPIEndpoint => {
const extractedID = url
.replace(/(https:\/\/)(www\.)?(youtu.*)\.(be|com)\/(watch\?v=)?/g, '')
.replace('&feature=share', '');
const endpoint = `https://youtube.googleapis.com/youtube/v3/videos?id=${extractedID}`;
const endpoint = `https://youtube.googleapis.com/youtube/v3/videos?part=snippet&id=${extractedID}`;
const link = `https://youtu.be/${extractedID}`;
const data: YouTubeAPIEndpoint = { endpoint, link };

console.log('[cleanUrl]:', data);

return data;
};

Expand All @@ -40,8 +39,6 @@ const getYouTubeDetails = async (url: string): Promise<BookmarkData> => {
const { endpoint, link } = cleanUrl(url);
const request = await fetch(`${endpoint}&key=${YOUTUBE_KEY}`);
const response: YouTubeResponse = await request.json();

console.log('[getYouTubeDetails]:', response);

if (response.items.length === 0) {
throw new Error('Getting youtube details: \n No video found');
Expand Down Expand Up @@ -79,7 +76,6 @@ export const bookmarkYouTube = async (
tags,
});

console.log('[bookmarkYouTube]:', airtableResp);
return { success: true, message: airtableResp, source: 'bookmarkYouTube' };
} catch (error) {
return { success: false, message: error, source: 'bookmarkYouTube' };
Expand Down

0 comments on commit 3143288

Please sign in to comment.