diff --git a/netlify/edge-functions/now-playing.js b/netlify/edge-functions/now-playing.js index ff23a340..414784c7 100644 --- a/netlify/edge-functions/now-playing.js +++ b/netlify/edge-functions/now-playing.js @@ -90,53 +90,6 @@ export default async () => { } } - const nbaRes = await fetch( - 'https://cdn.nba.com/static/json/liveData/scoreboard/todaysScoreboard_00.json' - ) - .then((data) => data.json()) - .catch() - const games = nbaRes?.scoreboard?.games - - if (games && games.length) { - const isAmPm = (hours) => (hours >= 12 ? 'pm' : 'am') - const game = games.find((game) => game.gameCode.includes('LAL')) - if (game) { - const startDate = new Date(game.gameTimeUTC) - const startTime = startDate.toLocaleString('en-US', { - timeZone: 'America/Los_Angeles', - }) - const endDate = startDate.setHours(startDate.getHours() + 3) - const endTime = new Date(endDate).toLocaleString('en-US', { - timeZone: 'America/Los_Angeles', - }) - const nowDate = new Date() - const now = nowDate.toLocaleString('en-US', { - timeZone: 'America/Los_Angeles', - }) - const isCorrectDate = - now.split(',')[0] === startTime.split(',')[0] && - now.split(',')[0] === endTime.split(',')[0] && - isAmPm(startDate.getHours()) === isAmPm(nowDate.getHours()) - const nowHour = parseInt(now.split(',')[1].split(':')[0].trim()) - const startHour = parseInt(startTime.split(',')[1].split(':')[0].trim()) - const endHour = parseInt(endTime.split(',')[1].split(':')[0].trim()) - const nowMinutes = parseInt(now.split(',')[1].split(':')[1].trim()) - const startMinutes = parseInt(startTime.split(',')[1].split(':')[1].trim()) - const endMinutes = parseInt(endTime.split(',')[1].split(':')[1].trim()) - const res = { - content: `🏀 ${game['awayTeam']['teamName']} (${game['awayTeam']['wins']}-${game['awayTeam']['losses']}) @ ${game['homeTeam']['teamName']} (${game['homeTeam']['wins']}-${game['homeTeam']['losses']})`, - } - - if (isCorrectDate) { - if (nowHour === startHour && nowMinutes >= startMinutes && nowHour < endHour) - return Response.json(res, headers) - if (nowHour > startHour && nowHour < endHour) return Response.json(res) - if (nowHour > startHour && nowMinutes <= endMinutes && nowHour == endHour) - return Response.json(res, headers) - } - } - } - const trackRes = await fetch( `https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=coryd_&api_key=${MUSIC_KEY}&limit=1&format=json`, { diff --git a/package.json b/package.json index 61dbf320..fe1714d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "4.3.1", + "version": "4.3.2", "description": "The source for my personal site, blog and portfolio. Built using 11ty and hosted on Netlify.", "type": "module", "scripts": {