<commit_before><?php
/**
 * PHP-IMDB-Grabber -- a PHP IMDb.com scraper
 *
 * This class can be used to retrieve data from IMDb.com with PHP.
 *
 * The technique used is called “web scraping”
 * (see http://en.wikipedia.org/wiki/Web_scraping for details).
 * Which means: If IMDb changes *anything* on their HTML, the script is going to
 * fail (even a single space might be enough).
 *
 * You might not know, but there is an IMDb API available. The problem?
 * You will have to pay at least $15.000 to use it. Great, thank you.
 *
 *
 * If you want to thank me for my work and the support, feel free to do this
 * through PayPal (use <EMAIL> as payment destination) or just
 * buy me a book at Amazon (http://www.amazon.de/wishlist/3IAUEEEY6GD20)
 * – thank you! :-)
 *
 *
 * @link http://fabian-beiner.de
 * @copyright 2011 <NAME>
 * @author <NAME> (<EMAIL>)
 * @license MIT License
 *
 * @version 5.4.2 (September 22th, 2011)
*/

class IMDBException extends Exception {}

class IMDB {
    // Define what to return if something is not found.
    public $strNotFound = 'n/A';
    // Please set this to 'true' for debugging purposes only.
    const IMDB_DEBUG    = false;
    // Define a timeout for the request of the IMDb page.
    const IMDB_TIMEOUT  = 15;

    // Regular expressions, I would not touch them. :)
    const IMDB_AKA          = '~<h4 class="inline">Also Known As:(.*)<span~Ui';
    const IMDB_BUDGET       = '~Budget:</h4> (.*)\(estimated\)~Ui';
    const IMDB_CAST         = '~<td class="name">\s+<a\s+href="/name/nm(\d+)/">(.*)</a>\s+</td~Ui';
    const IMDB_CHAR         = '~<td class="character">(.*)</td~Ui';
    const IMDB_COLOR        = '~<a href="/search/title\?colors=(.*)">(.*)</a>~Ui';
    const IMDB_COMPANY      = '~<h4 class="inline">Production Co:</h4>(.*)<span~Ui';
    const IMDB_COMPANY_NAME = '~href="/company/co(\d+)/">(.*)</a>~Ui';
    const IMDB_COUNTRY      = '~<a href="/country/(\w+)"(?:>| >)(.*)</a>~Ui';
    const IMDB_CREATOR      = '~<h4 class="inline">\s+(Creator|Creators):\s+</h4>(.*)</div><div~Ui';
    const IMDB_DIRECTOR     = '~<h4 class="inline">\s+(Director|Directors):\s+</h4>(.*)</div>~Ui';
    const IMDB_GENRE        = '~<a href="/genre/(.*)"~Ui';
    const IMDB_LANGUAGES    = '~<a href="/language/(\w+)" itemprop="inLanguage">(.*)</a>~Ui';
    const IMDB_LOCATION     = '~<h4 class="inline">Filming Locations:</h4> <a href="/search/title\?locations=(.*)">(.*)</a>~Ui';
    const IMDB_MPAA         = '~<span itemprop="contentRating">(.*)</span>~Ui';
    const IMDB_NAME         = '~href="/name/nm(\d+)/"(?:\s>|\s+itemprop="\w+">|>)(.*)</a>~Ui';
    const IMDB_PLOT         = '~<h2>Storyline</h2><p>(.*)(<em class="nobr">|</p>)~Ui';
    const IMDB_POSTER       = '~href="/media/(.*)"\s+><img src="(.*)"~Ui';
    const IMDB_RATING       = '~<span class="rating-rating"><span class="value".*?>(\d+\.\d+)</span>~Ui';
    const IMDB_REDIRECT     = '~Location:\s(.*)~';
    const IMDB_RELEASE_DATE = '~Release Date:</h4>(.*)(<span|</div>)~Ui';
    const IMDB_RUNTIME      = '~(\d+)\smin~Uis';
    const IMDB_SEARCH       = '~<b>Media from&nbsp;<a href="/title/tt(\d+)/"~i';
    const IMDB_SEASONS      = '~<h4 class="inline">Season: </h4><span class="see-more inline">(.*)</div><div~Ui';
    const IMDB_TAGLINE      = '~<h4 class="inline">Taglines:</h4>(.*)(<[^>]+>)~Ui';
    const IMDB_TITLE        = '~og:title" content="(.*) \((.*)\)"~Ui';
    const IMDB_TITLE_ORIG   = '~<span class="title-extra">(.*) <i>\(original title\)</i></span>~Ui';
    const IMDB_TRAILER2     = '~<a href="/video/(.*)/"~Ui';
    const IMDB_TRAILER      = '~href="/video/imdb/(.*)/"~Ui';
    const IMDB_URL          = '~http://(.*\.|.*)imdb.com/(t|T)itle(\?|/)(..\d+)~i';
    const IMDB_VOTES        = '~<span itemprop="ratingCount">(.*)</span>~Ui';
    const IMDB_WRITER       = '~<h4 class="inline">\s+(Writer|Writers):\s+</h4>(.*)</div>~Ui';

    // cURL cookie file.
    private $_fCookie   = false;
    // IMDb url.
    private $_strUrl    = NULL;
    // IMDb source.
    private $_strSource = NULL;
    // IMDb cache.
    private $_strCache  = 0;
    // IMDb posters directory.
    private $_bolPoster = false;
    // IMDb cache directory.<commit_msg>Fixed Title and Trailer (via GitHub). #2<commit_after><?php
/**
 * PHP-IMDB-Grabber -- a PHP IMDb.com scraper
 *
 * This class can be used to retrieve data from IMDb.com with PHP.
 *
 * The technique used is called “web scraping”
 * (see http://en.wikipedia.org/wiki/Web_scraping for details).
 * Which means: If IMDb changes *anything* on their HTML, the script is going to
 * fail (even a single space might be enough).
 *
 * You might not know, but there is an IMDb API available. The problem?
 * You will have to pay at least $15.000 to use it. Great, thank you.
 *
 *
 * If you want to thank me for my work and the support, feel free to do this
 * through PayPal (use <EMAIL> as payment destination) or just
 * buy me a book at Amazon (http://www.amazon.de/wishlist/3IAUEEEY6GD20)
 * – thank you! :-)
 *
 *
 * @link http://fabian-beiner.de
 * @copyright 2011 <NAME>
 * @author <NAME> (<EMAIL>)
 * @license MIT License
 *
 * @version 5.4.2 (September 22th, 2011)
*/

class IMDBException extends Exception {}

class IMDB {
    // Define what to return if something is not found.
    public $strNotFound = 'n/A';
    // Please set this to 'true' for debugging purposes only.
    const IMDB_DEBUG    = false;
    // Define a timeout for the request of the IMDb page.
    const IMDB_TIMEOUT  = 15;

    // Regular expressions, I would not touch them. :)
    const IMDB_AKA          = '~<h4 class="inline">Also Known As:(.*)<span~Ui';
    const IMDB_BUDGET       = '~Budget:</h4> (.*)\(estimated\)~Ui';
    const IMDB_CAST         = '~<td class="name">\s+<a\s+href="/name/nm(\d+)/">(.*)</a>\s+</td~Ui';
    const IMDB_CHAR         = '~<td class="character">(.*)</td~Ui';
    const IMDB_COLOR        = '~<a href="/search/title\?colors=(.*)">(.*)</a>~Ui';
    const IMDB_COMPANY      = '~<h4 class="inline">Production Co:</h4>(.*)<span~Ui';
    const IMDB_COMPANY_NAME = '~href="/company/co(\d+)/">(.*)</a>~Ui';
    const IMDB_COUNTRY      = '~<a href="/country/(\w+)"(?:>| >)(.*)</a>~Ui';
    const IMDB_CREATOR      = '~<h4 class="inline">\s+(Creator|Creators):\s+</h4>(.*)</div><div~Ui';
    const IMDB_DIRECTOR     = '~<h4 class="inline">\s+(Director|Directors):\s+</h4>(.*)</div>~Ui';
    const IMDB_GENRE        = '~<a href="/genre/(.*)"~Ui';
    const IMDB_LANGUAGES    = '~<a href="/language/(\w+)" itemprop="inLanguage">(.*)</a>~Ui';
    const IMDB_LOCATION     = '~<h4 class="inline">Filming Locations:</h4> <a href="/search/title\?locations=(.*)">(.*)</a>~Ui';
    const IMDB_MPAA         = '~<span itemprop="contentRating">(.*)</span>~Ui';
    const IMDB_NAME         = '~href="/name/nm(\d+)/"(?:\s>|\s+itemprop="\w+">|>)(.*)</a>~Ui';
    const IMDB_PLOT         = '~<h2>Storyline</h2><p>(.*)(<em class="nobr">|</p>)~Ui';
    const IMDB_POSTER       = '~href="/media/(.*)"\s+><img src="(.*)"~Ui';
    const IMDB_RATING       = '~<span class="rating-rating"><span class="value".*?>(\d+\.\d+)</span>~Ui';
    const IMDB_REDIRECT     = '~Location:\s(.*)~';
    const IMDB_RELEASE_DATE = '~Release Date:</h4>(.*)(<span|</div>)~Ui';
    const IMDB_RUNTIME      = '~(\d+)\smin~Uis';
    const IMDB_SEARCH       = '~<b>Media from&nbsp;<a href="/title/tt(\d+)/"~i';
    const IMDB_SEASONS      = '~<h4 class="inline">Season: </h4><span class="see-more inline">(.*)</div><div~Ui';
    const IMDB_TAGLINE      = '~<h4 class="inline">Taglines:</h4>(.*)(<[^>]+>)~Ui';
    const IMDB_TITLE        = '~og:title" content="(.*) \((.*)\)"~Ui';
    const IMDB_TITLE_ORIG   = '~<span class="title-extra">(.*) <i>\(original title\)</i></span>~Ui';
    const IMDB_TRAILER      = '~href="/video/imdb/(.*)/"~Ui';
    const IMDB_URL          = '~http://(.*\.|.*)imdb.com/(t|T)itle(\?|/)(..\d+)~i';
    const IMDB_VOTES        = '~<span itemprop="ratingCount">(.*)</span>~Ui';
    const IMDB_WRITER       = '~<h4 class="inline">\s+(Writer|Writers):\s+</h4>(.*)</div>~Ui';

    // cURL cookie file.
    private $_fCookie   = false;
    // IMDb url.
    private $_strUrl    = NULL;
    // IMDb source.
    private $_strSource = NULL;
    // IMDb cache.
    private $_strCache  = 0;
    // IMDb posters directory.
    private $_bolPoster = false;
    // IMDb cache directory.
{'fraction_non_alphanumeric': 0.2225284601557819, 'fraction_numerical': 0.01078490113840623, 'mean_word_length': 3.0338327694538423, 'pattern_counts': {'":': 0, '<': 144, '<?xml version=': 0, '>': 135, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4688697', 'n_tokens_mistral': 3251, 'n_tokens_neox': 3184, 'n_words': 689}