How to get all downloadable links details from the Downloadable Product Magento 2?

Magento 2 has a native Downloadable product to support all of that product that you can deliver as a file, video, music, ebook, software-related data. You can download/purchase the product from the product detail page.

All the links related to Downloadable items will be stored in the Database table name downloadable_link. The table contains the field of product_id, no. of downloads, link_url, link_file, type of link, sample file, and type.

Retrieve all the List of links with associated samples using the interface, Magento\Downloadable\Api\LinkRepositoryInterface with the product SKU as a parameter inside the getList($sku) method.

<?php
namespace Jesadiya\DownloadableLinks\Model;

use Magento\Downloadable\Api\Data\LinkInterface;
use Magento\Downloadable\Api\LinkRepositoryInterface;

class DownloadableLinks
{
    /**
     * @var LinkRepositoryInterface
     */
    private $linkRepository;

    public function __construct(
        LinkRepositoryInterface $linkRepository
    ) {
        $this->linkRepository = $linkRepository;
    }

    /**
     * Get list of links of Downloadable Product.
     *
     * @param string $sku
     * @return LinkInterface[]
     */
    public function getDownloadableLinks(string $sku): array
    {
        $downloadableLink = $this->linkRepository->getList($sku);

        return $downloadableLink;
    }
}

Call method with item SKU,

$sku = '240-LV09'; //Downloadable item sku
$downloadableLink = $this->getDownloadableLinks($sku);
foreach ($downloadableLink as $link) {
    var_dump($link->getData());
}

Using the above reference code, You can retrieve the list of links with associated samples of downloadable items.

You can get a list of samples for a downloadable product

You can also retrieve all the Downloadable links by the Downloadable Extension attributes value

Output:
Magento\Downloadable\Api\Data\LinkInterface[]

Array
(
    [link_id] => 6
    [id] => 6
    [title] => Episode 1
    [sort_order] => 1
    [sample_type] =>
    [sample_file] =>
    [sample_url] =>
    [price] => 9.000000
    [number_of_downloads] => 0
    [is_shareable] => 2
    [link_type] => file
    [link_file] => /l/u/luma_background_-_model_against_fence_4_sec_.mp4
    [link_url] =>
)
...