mirror of
https://github.com/discourse/discourse.git
synced 2026-03-04 01:15:08 +08:00
Reddit removed OpenGraph meta tags from their HTML responses, so oneboxing fails silently. This switches to fetching from Reddit's `.json` API endpoint instead. - Fetches post data from `.json` endpoint (appended to post URL) - Supports image, video, and self/text posts - Adds `matches_path` to restrict to actual post URLs - Adds `old.reddit.com`, `np.reddit.com`, `new.reddit.com` support - Flex-based layout for video post thumbnails (avoids legacy float issues) <img width="949" height="1434" alt="image" src="https://github.com/user-attachments/assets/40b3f4fa-ace5-4dd1-97a9-45d9497037e4" />
43 lines
1 KiB
Text
43 lines
1 KiB
Text
[
|
|
{
|
|
"kind": "Listing",
|
|
"data": {
|
|
"children": [
|
|
{
|
|
"kind": "t3",
|
|
"data": {
|
|
"title": "My cat doing a backflip",
|
|
"author": "cat_person_42",
|
|
"subreddit_name_prefixed": "r/cats",
|
|
"score": 12500,
|
|
"num_comments": 432,
|
|
"selftext": "",
|
|
"is_self": false,
|
|
"post_hint": "hosted:video",
|
|
"is_video": true,
|
|
"over_18": false,
|
|
"url": "https://v.redd.it/abc123def456",
|
|
"permalink": "/r/cats/comments/abc123/my_cat_doing_a_backflip/",
|
|
"preview": {
|
|
"images": [
|
|
{
|
|
"source": {
|
|
"url": "https://preview.redd.it/abc123def456.png?auto=webp&s=deadbeef",
|
|
"width": 1920,
|
|
"height": 1080
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"kind": "Listing",
|
|
"data": {
|
|
"children": []
|
|
}
|
|
}
|
|
]
|