1. Go to this page and download the library: Download gumphp/parse-video library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class VideoInfo
{
public string $videoUrl; // Direct video URL
public string $coverUrl; // Video thumbnail
public string $title; // Video title
public string $musicUrl; // Background music URL
public array $images; // Array of ImgInfo for image albums
public VideoAuthor $author; // Author information
}
class VideoAuthor
{
public string $uid; // Author ID
public string $name; // Author name
public string $avatar; // Author avatar URL
}
class ImgInfo
{
public string $url; // Image URL
public string $livePhotoUrl; // Live Photo video URL (if available)
}
use GumPHP\VideoParser\Exception\ParseException;
use GumPHP\VideoParser\Exception\UnsupportedSourceException;
try {
$videoInfo = $parser->parseShareUrl($url);
} catch (UnsupportedSourceException $e) {
// URL is from an unsupported platform
echo "Unsupported platform: " . $e->getMessage();
} catch (ParseException $e) {
// Parsing failed (video not found, API changed, etc.)
echo "Parsing failed: " . $e->getMessage();
} catch (\Exception $e) {
// Other errors (network issues, etc.)
echo "Error: " . $e->getMessage();
}
namespace GumPHP\VideoParser\Parser;
use GumPHP\VideoParser\Exception\ParseException;
use GumPHP\VideoParser\Model\VideoInfo;
class NewPlatform extends BaseParser
{
public function parseShareUrl(string $shareUrl): VideoInfo
{
// Implementation here
}
public function parseVideoId(string $videoId): VideoInfo
{
// Implementation here
}
}
bash
composer analyse
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.