Parses the official League of Legends website for information about the currently free champions
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

lolrotation - get IDs of the champions in the current free rotation


This gem scrapes the official League of Legends website - if they change the format of the news posts, this will break.


Since this gem is completely unfinished and bad, it's not in the directory yet, so you'll have to install it directly from github:

gem 'lolrotation', :git => 'git://'


This gem uses Nokogiri to parse the web site.


After installation, simply call LolRotation::Rotation.current in your application.

The resultant hash currently has only one key, :champion_ids, which points to an array of the IDs of the currently free champions.


result = LolRotation::Rotation.current    # {:champion_ids=>[12, 1, 14, 15, 26, 82, 81, 57, 101, 114]}
result[:champion_ids]                     # [12, 1, 14, 15, 26, 82, 81, 57, 101, 114]

Error handling

The only error handling this gem provides is returning an empty champion_ids array if no news post with a matching title has been found. This means that a plethora of Exceptions from open-uri or Nokogiri can get thrown, and you'll need to handle them on your own.


LolRotation supports the following configuration options:

  • news_page_url: the url of the League of Legends news page you want to parse. Default: ""
  • news_post_title: the title fragment used to identify a news post about a new champion rotation. Default: "Free Champion Rotation"
  • details_link_href_fragment: the href fragment used to identify links to champion pages . Default: "/champions/"

You can set them in a configuration block like this:

LolRotation.configure do |config|
  config.news_page_url = ""
  config.news_post_title = "We haff new rotation"
  config.details_link_href_fragment = "/heroes/"

The above example would try to find a post with the title "We haff new rotation" on (it's how they talk over there). Once found, it would search for links leading to pages with "/heroes/" in the path and use those to identify the champions.