<commit_before>#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http/persistent'
require 'date'
require 'logger'
require 'pry'


IMDB_BASE = 'http://www.imdb.com'
IMDB_NOW_SHOWING_URL = IMDB_BASE + '/movies-in-theaters/'
HTTP = Net::HTTP::Persistent.new('movies')
LOG = Logger.new(STDERR)
LOG.level = Logger::DEBUG

def fetch(url)
  HTTP.request(URI url).body
end

# Get the movies that are currently in theater
def get_now_showing_movies()
  LOG.info("Fetching all movies that are showing.")
  doc_tree = Nokogiri::HTML(fetch(IMDB_NOW_SHOWING_URL))
  nodes = doc_tree.xpath("//div[@itemscope]//h4[@itemprop='name']/a")
  nodes.collect { |mov| link_from_node(mov) }
end<commit_msg>Switch to a different movie source.<commit_after>#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http/persistent'
require 'date'
require 'logger'
require 'pry'


IMDB_BASE = 'http://www.imdb.com'
IMDB_NOW_SHOWING_URL = IMDB_BASE + '/showtimes/location?sort=title&ref_=shlc_sort'
HTTP = Net::HTTP::Persistent.new('movies')
LOG = Logger.new(STDERR)
LOG.level = Logger::DEBUG

def fetch(url)
  HTTP.request(URI url).body
end

# Get the movies that are currently in theater
def get_now_showing_movies()
  LOG.info("Fetching all movies that are showing.")
  doc_tree = Nokogiri::HTML(fetch(IMDB_NOW_SHOWING_URL))
  nodes = doc_tree.xpath("//div[@itemscope]//*[@itemprop='name']/a")
  nodes.collect { |mov| link_from_node(mov) }
end
{'fraction_non_alphanumeric': 0.1485148514851485, 'fraction_numerical': 0.0007072135785007072, 'mean_word_length': 5.706161137440758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '465037', 'n_tokens_mistral': 540, 'n_tokens_neox': 531, 'n_words': 108}