feat/api: add support for twitter bookmark links (#706)

* feat: add support for twitter bookmark links

* feat: add tests for bookmark twitter links
This commit is contained in:
KwiatekMiki 2024-10-03 08:26:38 +02:00 committed by GitHub
parent e419de07a4
commit b3137ad9ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 1 deletions

View file

@ -137,7 +137,8 @@ export const services = {
":user/status/:id/video/:index", ":user/status/:id/video/:index",
":user/status/:id/photo/:index", ":user/status/:id/photo/:index",
":user/status/:id/mediaviewer", ":user/status/:id/mediaviewer",
":user/status/:id/mediaViewer" ":user/status/:id/mediaViewer",
"i/bookmarks?post_id=:id"
], ],
subdomains: ["mobile"], subdomains: ["mobile"],
altDomains: ["x.com", "vxtwitter.com", "fixvx.com"], altDomains: ["x.com", "vxtwitter.com", "fixvx.com"],

View file

@ -120,6 +120,11 @@ function cleanURL(url) {
limitQuery('p') limitQuery('p')
} }
break; break;
case "twitter":
if (url.searchParams.get('post_id')) {
limitQuery('post_id')
}
break;
} }
if (stripQuery) { if (stripQuery) {

View file

@ -192,6 +192,24 @@
"code": 400, "code": 400,
"status": "error" "status": "error"
} }
},
{
"name": "bookmarked video",
"url": "https://twitter.com/i/bookmarks?post_id=1828099210220294314",
"params": {},
"expected": {
"code": 200,
"status": "redirect"
}
},
{
"name": "bookmarked photo",
"url": "https://twitter.com/i/bookmarks?post_id=1837430141179289876",
"params": {},
"expected": {
"code": 200,
"status": "redirect"
}
} }
], ],
"soundcloud": [ "soundcloud": [