Skip to content

Commit ed8e3ba

Browse files
committed
domains: better message for age-restricted Twitter posts
1 parent 0c30fa3 commit ed8e3ba

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

plugins/domains/twitter.com/twitter.status.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,20 @@ export default {
4242
return cb({
4343
responseStatusCode: 404,
4444
message: 'The tweet is no longer available.'
45-
})
45+
});
4646

4747
} else if (response.statusCode === 403) {
48-
return cb({
49-
responseStatusCode: 404,
50-
message: 'It looks this Twitter account has been suspended.'
51-
})
48+
if (/not\sauthorized/i.test(oembed.error)) { // ex. https://x.com/zoolininfts/status/1928051687077314857
49+
return cb({
50+
responseStatusCode: 403,
51+
message: 'Permission error, perhaps the content is age-restricted on Twitter.'
52+
});
53+
} else {
54+
return cb({
55+
responseStatusCode: 404,
56+
message: 'It looks this Twitter account has been suspended.'
57+
});
58+
}
5259

5360
} else if (response.statusCode !== 200) {
5461
return cb('Non-200 response from Twitter API (statuses/oembed.json: ' + response.statusCode);

0 commit comments

Comments
 (0)