<commit_before><?php namespace App\Http\Controllers;

use Carbon\Carbon;
use GuzzleHttp\Client;

class ParserVk extends Controller
{
    protected $client;
    protected $token;
    protected $version = '5.53';
    protected $vkpage;

    public function __construct()
    {
        parent::__construct();

        $this->client = new Client(['base_uri' => 'https://api.vk.com/method/']);
    }

    public function index($vkpage = 'pn6', $date = false)
    {
        $this->vkpage = $vkpage;
        $this->token = $token = $this->request->input('token');
        $own = $this->request->input('own');
        $date = false === $date ? '-1 day' : $date;
        $date = Carbon::parse($date);

        $count = 100;
        $offset = $total = 0;
        $parsed = false;
        $posts = collect();

        $date_start = Carbon::parse($date)->startOfDay()->timestamp;
        $date_end = Carbon::parse($date)->endOfDay()->timestamp;
        $previous = Carbon::parse($date)->subDay();
        $next = Carbon::now()->startOfDay()->gt($date) ? Carbon::parse($date)->addDay() : null;

        while (false === $parsed) {
            $json = $this->getPosts($count, $offset);

            if (isset($json->error)) {
                dd($json->error);
            }

            $total = $total ?: $json->response->count;
<commit_msg>Без токена больше не пускают<commit_after><?php namespace App\Http\Controllers;

use Carbon\Carbon;
use GuzzleHttp\Client;

class ParserVk extends Controller
{
    protected $client;
    protected $token;
    protected $version = '5.53';
    protected $vkpage;

    public function __construct()
    {
        parent::__construct();

        $this->client = new Client(['base_uri' => 'https://api.vk.com/method/']);
    }

    public function index($vkpage = 'pn6', $date = false)
    {
        $this->vkpage = $vkpage;
        $this->token = $token = $this->request->input('token', config('services.vk.access_token'));
        $own = $this->request->input('own');
        $date = false === $date ? '-1 day' : $date;
        $date = Carbon::parse($date);
        $token = $token === config('services.vk.access_token') ? null : $token;

        $count = 100;
        $offset = $total = 0;
        $parsed = false;
        $posts = collect();

        $date_start = Carbon::parse($date)->startOfDay()->timestamp;
        $date_end = Carbon::parse($date)->endOfDay()->timestamp;
        $previous = Carbon::parse($date)->subDay();
        $next = Carbon::now()->startOfDay()->gt($date) ? Carbon::parse($date)->addDay() : null;

        while (false === $parsed) {
            $json = $this->getPosts($count, $offset);

            if (isset($json->error)) {
                throw new \Exception($json->error->error_msg);
            }

            $total = $total ?: $json->response->count;

{'fraction_non_alphanumeric': 0.18536931818181818, 'fraction_numerical': 0.006392045454545455, 'mean_word_length': 2.5080946450809463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1862141', 'n_tokens_mistral': 900, 'n_tokens_neox': 851, 'n_words': 172}