I've implemented something alike recently in PHP. Using the api library I wrote a while back and doing a simple call on the discussions endpoint.
$api = new \Flagrow\Flarum\Api\Flarum('https://discuss.flarum.org');
/** @var \Flagrow\Flarum\Api\Resource\Collection $collection */
$collection = $api->discussions()->request();
$discussions = $collection->collect();
These are automatically sorted by newest first.
If you're looking for an embeddable piece of code, I have to disappoint you because I haven't seen something like that yet.