<commit_before>require 'json'

module Elcinema
  module Scrapper
    class Movie < Elcinema::Model
      ## Extend
      include Elcinema::Scrapper

      ## Attributes
      attr_accessor :document, :title

      BASE_URL = 'http://www.elcinema.com/en/now/eg'.freeze
      OMDB_URL = 'http://www.omdbapi.com/?t='.freeze

      ## Methods
      def titles
        prepare_document(path: BASE_URL)
        @document.css('div.row h3 a').map(&:content)
      end

      def omdb
        uri = URI(OMDB_URL + @title)
        tmp = JSON.parse(Net::HTTP.get(uri))
        return nil if tmp['Response'] == 'Error'<commit_msg>adding minimum year 2017<commit_after>require 'json'

module Elcinema
  module Scrapper
    class Movie < Elcinema::Model
      ## Extend
      include Elcinema::Scrapper

      ## Attributes
      attr_accessor :document, :title

      BASE_URL = 'http://www.elcinema.com/en/now/eg'.freeze
      OMDB_URL = 'http://www.omdbapi.com/?y=2017&t='.freeze

      ## Methods
      def titles
        prepare_document(path: BASE_URL)
        @document.css('div.row h3 a').map(&:content)
      end

      def omdb
        uri = URI(OMDB_URL + @title)
        tmp = JSON.parse(Net::HTTP.get(uri))
        return nil if tmp['Response'] == 'Error'
{'fraction_non_alphanumeric': 0.1291866028708134, 'fraction_numerical': 0.007974481658692184, 'mean_word_length': 2.447802197802198, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4307805', 'n_tokens_mistral': 437, 'n_tokens_neox': 411, 'n_words': 84}