Streamtape API

General subject and ideas
Post Reply
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Streamtape API

Post by husterdusk »

Image

A simple project to manipulate the Streamtape platform API. I see that many people have difficulty using its API, even with the information. It is a bit complex to assemble and use, so I come in this topic to share how to manipulate the Streamtape /API.

Important: never share your API data.
Last edited by husterdusk on Sun Jul 28, 2024 12:16 am, edited 1 time in total.
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Re: Streamtape API

Post by husterdusk »

(1) PHP

Replace "username", "password", and "folderId" with your actual Streamtape API credentials

Code: Select all

$username = '******'; // username
$password = '*******'; // password
$folderId = '******'; // ID of the folder
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Re: Streamtape API

Post by husterdusk »

(2)

Configure URL and parameters

Code: Select all

$listUrl = 'https://api.streamtape.com/file/listfolder';
$listParams = [
    'login' => $username,
    'key' => $password,
    'folder' => $folderId
];
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Re: Streamtape API

Post by husterdusk »

(3)

send a POST request

Code: Select all

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $listUrl);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $listParams);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Re: Streamtape API

Post by husterdusk »

(4)

And to finish process the response data using some conditions

Code: Select all

if ($httpCode === 200) {
    $responseData = json_decode($response, true);
    if (isset($responseData['result']) && is_array($responseData['result'])) {
        $files = $responseData['result']['files'];
        if (!empty($files)) {
            echo '<h2>Videos in Folder</h2>';
            echo '<ul>';
            foreach ($files as $file) {
                $fileId = $file['linkid'];
                $fileName = $file['name'];
                $fileUrl = $file['link'];

                $thumbnailUrl = 'https://api.streamtape.com/file/getsplash?login=' . $username . '&key=' . $password . '&file=' . $fileId;

                $curlThumb = curl_init();
                curl_setopt($curlThumb, CURLOPT_URL, $thumbnailUrl);
                curl_setopt($curlThumb, CURLOPT_RETURNTRANSFER, true);
                $thumbnailResponse = curl_exec($curlThumb);
                curl_close($curlThumb);

                $thumbnailData = json_decode($thumbnailResponse, true);
                $thumbnailUrl = $thumbnailData['result']; // Thumbnail URL

                echo '<li><a href="' . $fileUrl . '">' . $fileName . '</a><br>';
                echo '<img src="' . $thumbnailUrl . '" alt="Thumbnail"></li>';
            }
            echo '</ul>';
        } else {
            echo ' folder is empty.';
        }
    } else {
        echo 'Error retrieving the file list from the folder.';
    }
} else {
    echo 'Error connecting. HTTP: ' . $httpCode;
}
?>
User avatar
husterdusk
shell scraper
shell scraper
Posts: 16
Joined: Fri Aug 04, 2023 7:16 am

Re: Streamtape API

Post by husterdusk »

(5)

The style choice is up to you.

Result

Image
Post Reply