-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update twitter logic to use public (unofficial) api
- Loading branch information
1 parent
b5c54bd
commit f94b2af
Showing
17 changed files
with
1,812 additions
and
664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Borrowed from | ||
https://github.com/vercel-labs/react-tweet/tree/main/packages/react-tweet/src/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export async function getOEmbed(url: string): Promise<any> { | ||
const res = await fetch(`https://publish.twitter.com/oembed?url=${url}`) | ||
|
||
if (res.ok) return res.json() | ||
if (res.status === 404) return | ||
|
||
throw new Error(`Fetch for embedded tweet failed with code: ${res.status}`) | ||
} |
Oops, something went wrong.