mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
api/twitter: update no tweet error code
This commit is contained in:
parent
0d58fad580
commit
37efa035a2
1 changed files with 4 additions and 4 deletions
|
@ -119,6 +119,10 @@ export default async function({ id, index, toGif, dispatcher }) {
|
||||||
|
|
||||||
let tweetTypename = tweet?.data?.tweetResult?.result?.__typename;
|
let tweetTypename = tweet?.data?.tweetResult?.result?.__typename;
|
||||||
|
|
||||||
|
if (!tweetTypename) {
|
||||||
|
return { error: "fetch.empty" }
|
||||||
|
}
|
||||||
|
|
||||||
if (tweetTypename === "TweetUnavailable") {
|
if (tweetTypename === "TweetUnavailable") {
|
||||||
const reason = tweet?.data?.tweetResult?.result?.reason;
|
const reason = tweet?.data?.tweetResult?.result?.reason;
|
||||||
switch(reason) {
|
switch(reason) {
|
||||||
|
@ -133,10 +137,6 @@ export default async function({ id, index, toGif, dispatcher }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tweetTypename) {
|
|
||||||
return { error: "link.invalid" }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!["Tweet", "TweetWithVisibilityResults"].includes(tweetTypename)) {
|
if (!["Tweet", "TweetWithVisibilityResults"].includes(tweetTypename)) {
|
||||||
return { error: "content.post.unavailable" }
|
return { error: "content.post.unavailable" }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue