AparatVideoUploader
, (*1)
Simple Video Uploader for Aparat.com based on Goutte ., (*2)
Installation
Using Composer :
composer require m2sh/aparatvideouploader
Or
Clone this repo with
git clone https://github.com/m2sh/AparatVideoUploader
Then install Dependencies with composer install, (*3)
Requirments
- Because of using
GuzzleHttp client in Goutte this package only
work on PHP version 5.5 & above.
- An Account from Aparat.com.
Usage
First include composer auto loader :, (*4)
include 'vendor/autoload.php'
Create instalnce from uploader class :, (*5)
$uploader = new \m2sh\AparatVideoUploader\AparatVideoUploader();
Specify username & password of your aparat.com account :, (*6)
$uploader->setAuthenticationInfo('YOUR USERNAME', 'YOUR PASSWORD');
Methods
Login
Login User to aparat.com :
$uploader->login();
To find out that the login is successful, check isUserLoggedIn property :, (*7)
if($uploader->isUserLoggedIn) {
// do something
}
PrepareUpload
Prepares uploader to uploading video :
$uploader->prepareUpload();
Also you can use Chain method like this :
$uploader->login()->prepareUpload();, (*8)
GetVideoCategories
Get Video Categories for UploadVideo, (*9)
$categories = $uploader->getVideoCategories();
echo $categories[0];
UploadFromFile
Upload Video From file to your account :, (*10)
$file = __DIR__ . "/video/ghost.mp4";
$videoDetail = [
'title' => 'پسری که روح میشود',
'description' => 'شوخی با پدر',
'category' => 2,
'tags' => ['روح','شوخی'],
'comment_permission' => 'no'
];
$uploader->uploadFromFile($file,$videoDetail);
GetVideoList
Get uploaded video list
$videoList = $uploader->getVideoList();', (*11)
RemoveVideo
Removes Video with given remove_link url from GetVideoList method :
$uploader->removeVideo($videoList[0]['remove_link']);, (*12)
Issues
If you have find any bug in this package please create new issue., (*13)