Jump to content

Module:Rivals.com recruit url

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Frietjes (talk | contribs) at 19:03, 6 October 2016. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- This module forms a rivals.com URL for [[Template:College athlete recruit end]]
local p = {}

-- This is a list of schools without dedicated URLs
local searchname = {
	['akron'] = 'Akron',
	['airforce'] = 'Air%2520Force',
	['ballstate'] = 'Ball%2520State',
	['bowlinggreen'] = 'Bowling%2520Green',
	['bradley'] = 'Bradley',
	['buffalo'] = 'Buffalo',
	['butler'] = 'Butler',
	['calpoly'] = 'Cal%2520Poly',
	['cornell'] = 'Cornell',
	['davidson'] = 'Davidson',
	['delaware'] = 'Delaware',
	['drexel'] = 'Drexel',
	['gonzaga'] = 'Gonzaga'
}

function p.url(frame)
	local t = (frame.args['team'] or ''):lower()
	local y = tonumber(frame.args['year'] or '') or ''
	local sport = frame.args['sport'] or 'football'
	local sn = searchname[t]
	if sn then
		return 'https://n.rivals.com/search#?formValues=%257B%2522sport%2522:%2522' .. (sport == 'basketball' and 'Basketball' or 'Football')
			.. '%2522,%2522recruit_year%2522:' .. y 
			.. ',%2522college.common_name%2522:%255B%2522' .. sn 
			.. '%2522%255D,%2522page_number%2522:1,%2522position_group.abbreviation%2522:%2522%2522,%2522'
			.. 'position.abbreviation%2522:%2522%2522,%2522'
			.. 'status%2522:%255B%2522signed%2522,%2522verbal%2522%255D%257D'
	else
		return 'http://' .. t .. '.rivals.com/commitments/' .. sport .. '/' .. y
	end
end

return p