Sha256: ceb555afa0d058f2f31d874af4ba0899c6ba897bc8a0dbf75fda77ac2141c9f1
Contents?: true
Size: 710 Bytes
Versions: 2
Compression:
Stored size: 710 Bytes
Contents
# frozen_string_literal: true module AhlScraper class PlayerDataFetcher def initialize(player_id) @player_id = player_id end def call JSON.parse(player_data_without_bio, symbolize_names: true) end private def url "https://lscluster.hockeytech.com/feed/index.php?feed=statviewfeed&view=player&player_id=#{@player_id}&season_id=&site_id=3&key=ccb91f29d6744675&client_code=ahl&league_id=&lang=en&statsType=standard&callback=json" # rubocop:disable Layout/LineLength end def player_data_without_bio data = Nokogiri::HTML(URI.parse(url).open).text[5..-2] bio = data[/\"bio"\:(.*?)\,\"teamName/m, 1] data.gsub(bio, "\"\"") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ahl_scraper-0.2.0 | lib/ahl_scraper/fetchers/player_data_fetcher.rb |
ahl_scraper-0.1.1 | lib/ahl_scraper/fetchers/player_data_fetcher.rb |