mikeevstropov / vk-parser
The parser of the social network vk.com
Requires
- php: >=5.5
- danielstjules/stringy: ^3.0
- guzzlehttp/guzzle: ^6.0
- mikeevstropov/user-agent: ^1.0
- psr/cache: ^1.0
- psr/log: ^1.0
- webmozart/assert: ^1.2
Requires (Dev)
- php: >=5.6
- ext-curl: *
- ext-memcached: *
- mikeevstropov/vk-api: ^1.0
- monolog/monolog: ^1.22
- phpunit/phpunit: ^5.7
- symfony/cache: ^3.3
This package is not auto-updated.
Last update: 2021-06-26 10:30:25 UTC
README
The parser of the social network vk.com
Installation
Add dependency mikeevstropov/vk-parser
$ composer require mikeevstropov/vk-parser
Usage
Sorry, but examples will not be provided for this library.
VideoParser Interface
-
__constructor
VideoParser constructor
Arguments:
client
(GuzzleHttp\ClientInterface) - client instance requiredlogger
(null|Psr\Log\LoggerInterface) - logger instance or null as default
Returns:
Mikeevstropov\VkParser\VideoParser
-
getSourceList
Getting the source list
Arguments:
ownerId
(string) - ID of the video owner is requiredid
(string) - ID of the video is requireduserSession
(null|GuzzleHttp\Cookie\CookieJar) - user session or null as default
Returns:
array
- contain a keys "static", "embed" and "stream"false
- video does not exist, private (adult also) or blocked by lawnull
- source of the video is not supported
ExtendedVideoParser Interface
-
__constructor
ExtendedVideoParser constructor
Arguments:
client
(GuzzleHttp\ClientInterface) - client instance requiredlogger
(null|Psr\Log\LoggerInterface) - logger instance or null as defaultcache
(null|Psr\SimpleCache\CacheInterface) - cache instance or null as default
Returns:
Mikeevstropov\VkParser\ExtendedVideoParser
-
getSourceList
Getting the source list
Arguments:
ownerId
(string) - ID of the video owner is requiredid
(string) - ID of the video is requireduserSession
(null|GuzzleHttp\Cookie\CookieJar) - user session or null as defaultcache
(bool) - use the cache, is true as defaultcacheTtl
(null|int) - number of seconds or null as default
Returns:
array
- contain a keys "static", "embed" and "stream"false
- video does not exist, private (adult also) or blocked by lawnull
- source of the video is not supported
Development
Clone
$ git clone https://github.com/mikeevstropov/vk-parser.git
Go to project
$ cd vk-parser
Install dependencies
$ composer install
Set permissions
$ sudo chmod 777 ./var -v -R
Configure testing environment in phpunit.xml
. Make sure the environment
variables "userLogin", "userPassword" and "applicationId" is not empty.
<phpunit> <php> <env name="logLevel" value="DEBUG"/> <env name="logFile" value="var/logs/parser.test.log"/> <env name="memcachedConnection" value="memcached://localhost"/> <env name="userLogin" value=""/> <env name="userPassword" value=""/> <env name="applicationId" value=""/> </php> </phpunit>
Increase composer timeout. Since composer by default set it to 300 seconds.
$ composer config --global process-timeout 900
Run the tests
$ composer test