mikeevstropov/vk-parser

This package is abandoned and no longer maintained. No replacement package was suggested.

The parser of the social network vk.com

1.0.2 2017-06-26 09:14 UTC

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 required
    • logger (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 required
    • id (string) - ID of the video is required
    • userSession (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 law
    • null - source of the video is not supported

ExtendedVideoParser Interface

  • __constructor

    ExtendedVideoParser constructor

    Arguments:

    • client (GuzzleHttp\ClientInterface) - client instance required
    • logger (null|Psr\Log\LoggerInterface) - logger instance or null as default
    • cache (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 required
    • id (string) - ID of the video is required
    • userSession (null|GuzzleHttp\Cookie\CookieJar) - user session or null as default
    • cache (bool) - use the cache, is true as default
    • cacheTtl (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 law
    • null - 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