Skip to content

Commit b3137ad

Browse files
authored
feat/api: add support for twitter bookmark links (#706)
* feat: add support for twitter bookmark links * feat: add tests for bookmark twitter links
1 parent e419de0 commit b3137ad

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

api/src/processing/service-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ export const services = {
137137
":user/status/:id/video/:index",
138138
":user/status/:id/photo/:index",
139139
":user/status/:id/mediaviewer",
140-
":user/status/:id/mediaViewer"
140+
":user/status/:id/mediaViewer",
141+
"i/bookmarks?post_id=:id"
141142
],
142143
subdomains: ["mobile"],
143144
altDomains: ["x.com", "vxtwitter.com", "fixvx.com"],

api/src/processing/url.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ function cleanURL(url) {
120120
limitQuery('p')
121121
}
122122
break;
123+
case "twitter":
124+
if (url.searchParams.get('post_id')) {
125+
limitQuery('post_id')
126+
}
127+
break;
123128
}
124129

125130
if (stripQuery) {

api/src/util/tests.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@
192192
"code": 400,
193193
"status": "error"
194194
}
195+
},
196+
{
197+
"name": "bookmarked video",
198+
"url": "https://twitter.com/i/bookmarks?post_id=1828099210220294314",
199+
"params": {},
200+
"expected": {
201+
"code": 200,
202+
"status": "redirect"
203+
}
204+
},
205+
{
206+
"name": "bookmarked photo",
207+
"url": "https://twitter.com/i/bookmarks?post_id=1837430141179289876",
208+
"params": {},
209+
"expected": {
210+
"code": 200,
211+
"status": "redirect"
212+
}
195213
}
196214
],
197215
"soundcloud": [

0 commit comments

Comments
 (0)