The parser of the social network vk.com
Add dependency mikeevstropov/vk-parser
$ composer require mikeevstropov/vk-parser
Sorry, but examples will not be provided for this library.
-
__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
-
__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
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