Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nastita committed Oct 21, 2024
1 parent 19529a6 commit 8267b28
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions domains/grid/utils/gridParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,30 +171,27 @@ async function getSpotifyOEmbed(url: string): Promise<string | undefined> {
}

async function getXOEmbedFromHandle(handle: string) {
handle = handle.replace('@', '')
const response = await fetch(
`https://publish.twitter.com/oembed?url=https://twitter.com/${handle}`
`https://publish.twitter.com/oembed?url=https://twitter.com/${handle.replace('@', '')}`
)

return response.ok ? ((await response.json())?.html as string) : undefined
}

function sanitizeXEmbedUrl(url: string): string {
url = url.replace('x.com', 'twitter.com')

if (!url.startsWith('https://')) {
url = `https://${url}`
let newUrl = url.replace('x.com', 'twitter.com')
if (!newUrl.startsWith('https://')) {
newUrl = `https://${newUrl}`
}

return url
return newUrl
}

function sanitizeYoutubeEmbedUrl(url: string): string {
url = url.replace('watch?v=', 'embed/')

let newUrl = url.replace('watch?v=', 'embed/')
if (!url.startsWith('https://')) {
url = `https://${url}`
newUrl = `https://${newUrl}`
}

return url
return newUrl
}

0 comments on commit 8267b28

Please sign in to comment.