<commit_before><?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Alaouy\Youtube\Youtube;
use TrafficBow\Video;

class YoutubeSpider extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'youtube:spider {--rows=3} {--days=0}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Parse YouTube keywords and save 3bow videos';

    protected $youtube;

    public function __construct()
    {
        parent::__construct();
        $this->youtube =  new Youtube(config('youtube.api_key'));
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->findKeywords('三寶 -新聞 -試駕');
        $this->findKeywords('行車記錄 違規 -新聞 -試駕');
        $this->findKeywords('三寶 行車 -新聞 -試駕');
        $this->findKeywords('三寶 闖紅燈 -新聞 -試駕');
        $this->findKeywords('並排 違規 -新聞 -試駕');
        $this->findKeywords('計程車 違規 -新聞 -試駕');
        $this->findKeywords('不開大燈 -新聞 -試駕 -來自星星的事');
        $this->findKeywords('逆向 三寶 -新聞 -試駕');
        $this->findKeywords('開車門 三寶 -新聞 -試駕');

    }

    protected function findKeywords($keyword)
    {
        $this->info($keyword);
        $rows = $this->option('rows');
        $days = $this->option('days');
        $videoList = $this->youtube->searchAdvanced([
            'q' => $keyword,
            'type' => 'video',
            'part' => 'id,snippet',<commit_msg>Remove 1 search keyword condition<commit_after><?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Alaouy\Youtube\Youtube;
use TrafficBow\Video;

class YoutubeSpider extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'youtube:spider {--rows=3} {--days=0}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Parse YouTube keywords and save 3bow videos';

    protected $youtube;

    public function __construct()
    {
        parent::__construct();
        $this->youtube =  new Youtube(config('youtube.api_key'));
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->findKeywords('三寶 -新聞 -試駕');
        $this->findKeywords('行車記錄 違規 -新聞 -試駕');
        $this->findKeywords('三寶 行車 -新聞 -試駕');
        $this->findKeywords('三寶 闖紅燈 -新聞 -試駕');
        $this->findKeywords('並排 違規 -新聞 -試駕');
        $this->findKeywords('計程車 違規 -新聞 -試駕');
        $this->findKeywords('逆向 三寶 -新聞 -試駕');
        $this->findKeywords('開車門 三寶 -新聞 -試駕');

    }

    protected function findKeywords($keyword)
    {
        $this->info($keyword);
        $rows = $this->option('rows');
        $days = $this->option('days');
        $videoList = $this->youtube->searchAdvanced([
            'q' => $keyword,
            'type' => 'video',
            'part' => 'id,snippet',
{'fraction_non_alphanumeric': 0.15893385982230998, 'fraction_numerical': 0.002303389272787101, 'mean_word_length': 2.2169312169312168, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, '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': '1442483', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1138, 'n_words': 223}