How to get list of samples for downloadable product Magento 2?

You can retrieve the list of samples for the downloadable products in Magento 2 Programmatically by item SKU.

Samples Contain the information for the product which is downloadable with Sample title, Uploaded file or file URL. You can attach multiple samples for the single product from the Magento backend, product section with Downloadable Information Tab.

Used Interface Magento\Downloadable\Api\SampleRepositoryInterface with getList($sku) method to fetch all the samples from the product,

<?php
namespace Jesadiya\Samples\Model;

use Magento\Downloadable\Api\Data\SampleInterface;
use Magento\Downloadable\Api\SampleRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Psr\Log\LoggerInterface;

class Data
{
    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * @var SampleRepositoryInterface
     */
    private $sampleRepository;

    public function __construct(
        LoggerInterface $logger,
        SampleRepositoryInterface $sampleRepository
    ) {
        $this->logger = $logger;
        $this->sampleRepository = $sampleRepository;
    }

    /**
     * Get all the samples data from the downloadable item
     *
     * @return SampleInterface[]
     */
    public function getSampleData(string $sku)
    {
        $samples = [];
        try {
            $samples = $this->sampleRepository->getList($sku);
        } catch (NoSuchEntityException $exception) {
            $this->logger->error($exception->getMessage());
        }
        return $samples;
    }
}

Call from the template or any PHP class,

$sku = '240-LV09';
$samples = $this->getSampleData($sku);
foreach ($samples as $sample) {
    echo "<pre>";print_r($sample->getData());
}
samples downloadable product
Downloadable product Samples

Product SKU 240-LV09 has multiple Sample attachment in Native Magento Sample Data. You can explore that item from the admin panel to see more details.

Output with Magento Native Sample Data: \Magento\Downloadable\Api\Data\SampleInterface[]

Array
(
    [sample_id] => 16
    [id] => 16
    [title] => Trailer #1
    [sort_order] => 1
    [sample_type] => file
    [sample_file] => /l/u/luma_background_-_model_against_fence_4_sec_.mp4
    [sample_url] => 
)
Array
(
    [sample_id] => 17
    [id] => 17
    [title] => Trailer #2
    [sort_order] => 1
    [sample_type] => file
    [sample_file] => /l/u/luma_background_-_model_against_fence_4_sec_.mp4
    [sample_url] => 
)
Array
(
    [sample_id] => 18
    [id] => 18
    [title] => Trailer #3
    [sort_order] => 1
    [sample_type] => file
    [sample_file] => /l/u/luma_background_-_model_against_fence_4_sec_.mp4
    [sample_url] => 
)

If you are searching for the links instead of samples click the link, Get all downloadable links details from the Downloadable Product.