<commit_before><?php

namespace Tndhl\LinkPreview\Parsers;

use Tndhl\LinkPreview\Contracts\LinkInterface;
use Tndhl\LinkPreview\Contracts\PreviewInterface;
use Tndhl\LinkPreview\Contracts\ReaderInterface;
use Tndhl\LinkPreview\Contracts\ParserInterface;
use Tndhl\LinkPreview\Exceptions\ConnectionErrorException;
use Tndhl\LinkPreview\Models\Link;
use Tndhl\LinkPreview\Readers\HttpReader;
use Tndhl\LinkPreview\Models\HtmlPreview;
use Symfony\Component\DomCrawler\Crawler;

/**
 * Class HtmlParser
 */
class HtmlParser extends BaseParser implements ParserInterface
{
    /**
     * Supported HTML tags
     *
     * @var array
     */
    private $tags = [
        'cover' => [
            ['selector' => 'meta[itemprop="image"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:image"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'value']
        ],

        'title' => [
            ['selector' => 'meta[itemprop="name"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:title"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="twitter:title"]', 'attribute' => 'value'],
            ['selector' => 'title']
        ],

        'description' => [
            ['selector' => 'meta[itemprop="description"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:description"]', 'attribute' => 'content'],
            ['selector' => 'meta[name="description"]', 'attribute' => 'content']
        ]
    ];

    /**
     * Smaller images will be ignored
     * @var int
     */
    private $imageMinimumWidth = 300;
    private $imageMinimumHeight = 300;

    /**
     * @param ReaderInterface $reader
     * @param PreviewInterface $preview
     */
    public function __construct(ReaderInterface $reader = null, PreviewInterface $preview = null)<commit_msg>Changes: Add selector for a cover<commit_after><?php

namespace Tndhl\LinkPreview\Parsers;

use Tndhl\LinkPreview\Contracts\LinkInterface;
use Tndhl\LinkPreview\Contracts\PreviewInterface;
use Tndhl\LinkPreview\Contracts\ReaderInterface;
use Tndhl\LinkPreview\Contracts\ParserInterface;
use Tndhl\LinkPreview\Exceptions\ConnectionErrorException;
use Tndhl\LinkPreview\Models\Link;
use Tndhl\LinkPreview\Readers\HttpReader;
use Tndhl\LinkPreview\Models\HtmlPreview;
use Symfony\Component\DomCrawler\Crawler;

/**
 * Class HtmlParser
 */
class HtmlParser extends BaseParser implements ParserInterface
{
    /**
     * Supported HTML tags
     *
     * @var array
     */
    private $tags = [
        'cover' => [
            ['selector' => 'meta[itemprop="image contentUrl"]', 'attribute' => 'content'],
            ['selector' => 'meta[itemprop="image"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:image"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'value']
        ],

        'title' => [
            ['selector' => 'meta[itemprop="name"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:title"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="twitter:title"]', 'attribute' => 'value'],
            ['selector' => 'title']
        ],

        'description' => [
            ['selector' => 'meta[itemprop="description"]', 'attribute' => 'content'],
            ['selector' => 'meta[property="og:description"]', 'attribute' => 'content'],
            ['selector' => 'meta[name="description"]', 'attribute' => 'content']
        ]
    ];

    /**
     * Smaller images will be ignored
     * @var int
     */
    private $imageMinimumWidth = 300;
    private $imageMinimumHeight = 300;

    /**
     * @param ReaderInterface $reader
     * @param PreviewInterface $preview
     */
    public function __construct(ReaderInterface $reader = null, PreviewInterface $preview = null)
{'fraction_non_alphanumeric': 0.16696360397047594, 'fraction_numerical': 0.003054212267752609, 'mean_word_length': 3.2394822006472492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '2330479', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1119, 'n_words': 217}