PHP code example of nehalvpatel / periscope-downloader

1. Go to this page and download the library: Download nehalvpatel/periscope-downloader 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/ */

    

nehalvpatel / periscope-downloader example snippets




ehalvpatel\PeriscopeDownloader;

$url = "https://www.periscope.tv/w/aLNeFzcxNTU4OTB8MU93eFdqV2JMWG5KUYZyGwCPkFvgC3JUE0AN9NhEjC-hHOCPBg1HCrUoiMxg";

$periscope_downloader = new PeriscopeDownloader();
echo $periscope_downloader->download($url); // returns location of combined .ts file

$url = "https://www.periscope.tv/w/aLNeFzcxNTU4OTB8MU93eFdqV2JMWG5KUYZyGwCPkFvgC3JUE0AN9NhEjC-hHOCPBg1HCrUoiMxg";
$directory = "/path/to/save/folder"; // defaults to __DIR__
$filename = "my_periscope.ts"; // defaults to $username_$date.ts

$periscope_downloader->download($url, $directory, $filename);

try {
    $periscope_downloader->download($url);
}
catch (\Exception $e) {
    switch ($e->getCode() {
        case 1:
            echo "Unsupported URL";
            break;
        case 2:
            echo "Invalid watchonperiscope.com URL";
            break;
        case 3:
            echo "Invalid Periscope token";
            break;
        default:
}