Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21d30d0890c845c

Jump to content

Module:Cite certification/URL/sandbox

From Wikipedia, the free encyclopedia
-- For each country, you can pass args (arguments from the original template),
-- certyear (the certyear in numerical format, or null if missing or invalid),
-- and source (the source, if different from that passed to the original template)
--
-- To return an error message, return the error string inside a table, e.g.
-- {'ERROR'}
-- Otherwise, any returned string is assumed to be a valid URL.

local yesno = require('Module:Yesno')
local function isblank(v) return (v or '') == '' end
local function notblank(v) return (v or '') ~= '' end

local regions = {
	argentina = function(args)
		if notblank(args.title) or notblank(args.artist) then
			return 'http://www.capif.org.ar/Default.asp?PerDesde_MM=0&PerDesde_AA=0&PerHasta_MM=0&PerHasta_AA=0&interprete=' ..
				mw.uri.encode(args.artist or '') ..
				'&album=' .. mw.uri.encode(args.title or '') ..
				'&LanDesde_MM=0&LanDesde_AA=0&LanHasta_MM=0&LanHasta_AA=0&Galardon=O&Tipo=' ..
				({
					album = '1',
					video = '2',
				})[mw.ustring.lower(args.type or '')] or '0' ..
				'&ACCION2=+Buscar+&ACCION=Buscar&CO=5&CODOP=ESOP'
		end
		return 'http://www.capif.org.ar/Default.asp?CodOp=ESOP&CO=5'
	end,
	
	australia = function(args, certyear, source)
		local type = mw.ustring.lower(args.type or '')
	
		if source == 'yearchart' then
			local year = certyear
			if year and year < 1993 and year > 1989 then
				year = year + 1
			end

			local chart = ({
				single = 'singles-chart',
				album = 'albums-chart',
				video = 'music-dvd-chart',
			})[type]

			if not chart then return
				{'MISSING OR INVALID type WAS PROVIDED FOR AUSTRALIA CERTIFICATION.'}
			end
	
			return 'https://www.aria.com.au/charts/' .. year .. '/' .. chart
		end
	
		if notblank(args.id) then
			return 'https://www.aria.com.au/charts/' ..
				(yesno(args.domestic) and 'australian-artist-' or '') ..
				(type == 'single' and 'singles' or 'albums') ..
				'-chart/' .. args.id
		end
	
		return ({
			[1990] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADMNJGMy_si25BoL1PeKWT_a/1990%20Accreds.pdf',
			[1991] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACjuKIBKG0f_IBblLVewtKva/1991%20Accreds.pdf',
			[1992] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAimRgSEwbskg43Gp0c7l0ka/1992%20Accreds.pdf',
			[1993] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AABq2J0lwnuqqey4FLDBqKoba/1993%20Accreds.pdf',
			[1994] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADfk_xu0JtPN9xmTCuF2mCra/1994%20Accreds.pdf',
			[1995] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACqiVS2PUOBjbCba4ok1S91a/1995%20Accreds.pdf',
			[1996] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADoT30FMJfQmJxmToYDpcO-a/1996%20Accreds.pdf',
			[1997] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADZbLSei--9mqfOiTFRIASMa/1997%20Accreds.pdf',
			[1998] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAD6BUynvHbdGxT3lvCkFhC2a/1998%20Accreds.pdf',
			[1999] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAATLmfMH7Iov9d0mORy7iY0a/1999%20Accreds.pdf',
			[2000] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAABeYGTvZErtZotNbXOr2Tza/2000%20Accreds.pdf',
			[2001] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADhw4ljwWQtLQiu3AKHh2fEa/2001%20Accreds.pdf',
			[2002] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAB_dhE5TMeNlf3JjRPhKwfla/2002%20Accreds.pdf',
			[2003] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAPr-mldzIAc3tSaFZxk5fha/2003%20Accreds.pdf',
			[2004] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AADOuO49m4ktOxAMI8EhwyLQa/2004%20Accreds.pdf',
			[2005] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AABxMKk3Lrf-VUHrS4_CfKrba/2005%20Accreds.pdf',
			[2006] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AABM36ml6jQbQXLUFgPhev7ia/2006%20Accreds.pdf',
			[2007] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACv2IzaxApS2wDjUm2Sv59Va/2007%20Accreds.pdf',
			[2008] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACIy6L0vRyXEayNcbS-HgDKa/2008%20Accreds.pdf',
			[2009] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAkIHUsZxjA2_mq5yRhmM7aa/2009%20Accreds.pdf',
			[2010] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAC3Qs7otXiVLTXdz456Af2Xa/2010%20Accreds.pdf',
			[2011] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAJJrqHEx_H2AkwuL1RJvc4a/2011%20Accreds.pdf',
			[2012] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACBYBePZLRMLmM96QFIFbFta/2012%20Accreds.pdf',
			[2013] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAB7SWdLlf4IXOeTFbi1j7-ia/2013%20Accreds.pdf',
			[2014] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AABqwZW0sRsAMdTNAZlDRcmWa/2014%20Accreds.pdf',
			[2015] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAB9XoKS5eunPKk6wwRzaGnpa/2015%20Accreds.pdf',
			[2016] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAdVk17fViUnXNKd5SZXapJa/2016%20Accreds.pdf',
			[2017] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAB2qTo9d_gGzbMZHhDTvHJ4a/2017%20Accreds.pdf',
			[2018] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AABFFGIVR9Plblvmp9DSoiEia/2018%20Accreds.pdf',
			[2019] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AACJzS4-BgOGT6m-zQ3-bvDba/2019%20Accreds.pdf',
			[2020] = 'https://www.dropbox.com/sh/k9o2q7p7o4awhqx/AAAg37tFuJyo-YI2WkNFWDQ9a/2020%20Accreds.pdf',
			[2021] = 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AGqF5SqiFMWNbqRDg5QpO8U/2021%20Accreds.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf',
			[2022] = 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AJgnk65H2gn9pbZqnwzHEtk/2022%20Accreds.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf',
			[2023] = 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AExzyTkHniRw2CkE2G9HX6Y/2023%20Accreds.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf',
		})[certyear]
			or (certyear == 2024 and (type == 'single'
				and 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AMdhOf4iGEmYJ6OQbGyumAE/2024%20Accreditations%20-%20Singles.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'
				or 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AD_UPzzW8XZbu2kvJAmyGUA/2024%20Accreditations%20-%20Albums.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'))
			or (certyear == 2025 and (type == 'single'
				and 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AC20e6S31r09Z79I9T85o9o/2025%20Single%20Accreditations.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'
				or 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/ANd1-yerJr4k8Jls_6CmF8I/2025%20Album%20Accreditations.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'))
			or (certyear == 2026 and (type == 'single'
				and 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/AJlIqh9lkdMaVDvy9rsaUAk/Apr%20Single%20Accreds%202026.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'
				or 'https://www.dropbox.com/scl/fo/orr9fphn3kyhykimwm11l/ACpiqNQcY1-ymRhg1eRZTXo/Apr%20Album%20Accreds%202026.pdf?rlkey=b5et6u9n5p7f3gkxgmqhivbyf'))
			or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
				.. 'PROVIDED FOR AUSTRALIA CERTIFICATION.'})
		
	end,
	
	austria = function(args)
		local type = mw.ustring.lower(args.type or '')
		return 'https://ifpi.at/auszeichnungen/?fwp_per_page=100&'
			.. (notblank(args.artist) and ('fwp_interpret=' .. mw.uri.encode(args.artist) .. '&') or '')
			.. (notblank(args.title) and ('fwp_titel=' .. mw.uri.encode(args.title) .. '&') or '')
			.. ({
				album = 'fwp_format=album&',
				single = 'fwp_format=single&',
				video = 'fwp_format=dvd&',
			})[type] or ''
	end,
	
	belgium = function(args, certyear)
		if certyear then
			return 'https://www.ultratop.be/nl/goud-platina/' .. certyear .. '/'
				.. (mw.ustring.lower(args.type or '') == 'album' and 'albums' or 'singles')
		end
		return 'https://www.ultratop.be/nl/certifications.asp'
	end,
	
	brazil = function(args)
		if notblank(args.artist) then
			local type = mw.ustring.lower(args.type or '')
			return 'https://pro-musicabr.org.br/home/certificados/?busca_artista='
				.. mw.uri.encode(args.artist)
				.. '&busca_tipo_produto='
				.. ({
					album = 'ÁLBUM',
					single = 'SINGLE',
					video = 'DVD',
				})[type] or ''
		end
		return 'https://pro-musicabr.org.br/home/certificados/'
	end,
	
	canada = function(args, certyear)
		local type = mw.ustring.lower(args.type or '')
	
		if notblank(args.artist) or notblank(args.title) then
			local url = 'https://musiccanada.com/gold-platinum/?_gp_search='
				.. mw.uri.encode((args.title or '') .. ' ' .. (args.artist or ''))
	
			if type == 'single' and yesno(args.digital) then
				url = url .. '&_gp_format=digital-download'
			elseif type == 'ringtone' then
				url = url .. '&_gp_format=ringtone'
			end
	
			return url
		end
	
		if certyear then
			if certyear < 2001 then
				if tonumber(args.certmonth) then
					return string.format(
						'http://www.cria.ca/gold/%02d%02d_g.php',
						tonumber(args.certmonth),
						certyear - 2000
					)
				end
			end
			return 'https://musiccanada.com/gold-platinum/'
		end
	end,
	
	['central america'] = function()
		return 'https://cfc-musica.com/certificaciones-1'
	end,

	denmark = function(args, certyear, source)
		if source == 'chart' then
			if isblank(args.id) then return
				{'MISSING OR INVALID id WAS PROVIDED FOR DENMARK CERTIFICATION.'}
			end

			local type = ({
				album = 'a40',
				compilation = 'c40',
				video = 'v40',
				single = certyear and certyear < 2007 and 's20' or 't40',
			})[mw.ustring.lower(args.type or '')]

			return 'https://www.hitlisten.nu/default.asp?w=' .. args.id
				.. '&y=' .. certyear .. '&list=' .. (type or '')
		end
	
		if notblank(args.id) then
			return 'http://ifpi.dk/node/' .. args.id
		end
	
		return 'http://www.ifpi.dk/certificeringer-0'
	end,
	
	europe = function(_, certyear)
		return ({
			[2014] = 'https://web.archive.org/web/20160113192750/http://ifpi.org/platinum_awards.php',
			[2013] = 'https://web.archive.org/web/20141010153939/http://www.ifpi.org/platinum_awards.php',
			[2012] = 'https://web.archive.org/web/20131102124403/http://www.ifpi.org/content/section_news/plat2012.html',
			[2011] = 'https://web.archive.org/web/20131014110104/http://ifpi.org/content/section_news/plat2011.html',
			[2010] = 'https://web.archive.org/web/20131102114825/http://ifpi.org/content/section_news/plat2010.html',
			[2009] = 'https://web.archive.org/web/20131019044551/http://www.ifpi.org/content/section_news/plat2009.html',
			[2008] = 'https://web.archive.org/web/20131128043857/http://ifpi.org/content/section_news/plat2008.html',
			[2007] = 'https://web.archive.org/web/20131127154333/http://ifpi.org/content/section_news/plat2007.html',
			[2006] = 'https://web.archive.org/web/20131016052153/http://www.ifpi.org/content/section_news/plat2006.html',
			[2005] = 'https://web.archive.org/web/20131224220023/http://www.ifpi.org/content/section_news/plat2005.html',
			[2004] = 'https://web.archive.org/web/20131019023820/http://www.ifpi.org/content/section_news/plat2004.html',
			[2003] = 'https://web.archive.org/web/20131103083215/http://www.ifpi.org/content/section_news/plat2003.html',
			[2002] = 'https://web.archive.org/web/20131224193414/http://www.ifpi.org/content/section_news/plat2002.html',
			[2001] = 'https://web.archive.org/web/20131127151231/http://ifpi.org/content/section_news/plat2001.html',
			[2000] = 'https://web.archive.org/web/20131127154733/http://ifpi.org/content/section_news/plat2000.html',
			[1999] = 'https://web.archive.org/web/20131127154154/http://ifpi.org/content/section_news/plat1999.html',
			[1998] = 'https://web.archive.org/web/20131117195048/http://ifpi.org/content/section_news/plat1998.html',
			[1997] = 'https://web.archive.org/web/20131127160311/http://ifpi.org/content/section_news/plat1997.html',
			[1996] = 'https://web.archive.org/web/20131224215935/http://www.ifpi.org/content/section_news/plat1996.html',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
			.. 'PROVIDED FOR EUROPE CERTIFICATION.'})
	end,
	
	finland = function(args)
		local url = 'https://www.ifpi.fi/tutkimukset-ja-tilastot/kulta-ja-platinalevyt/?'
	
		if not yesno(args.domestic) then
			url = url .. 'ulkomaiset=1&'
		end
		if notblank(args.artist) then
			url = url .. 'q=' .. mw.uri.encode(args.artist)
		end
	
		return url
	end,
	
	france = function(args, certyear, source)
		local type = mw.ustring.lower(args.type or '')
	
		if source == 'infodisc' then
			return type == 'album'
				and 'https://www.infodisc.fr/Album_Certifications.php'
				or 'https://www.infodisc.fr/Chanson_Certifications.php'
		elseif source == 'archive' then
			if certyear == 2012 then
				return 'http://proxy.siteo.com.s3.amazonaws.com/www.snepmusique.com/file/disques-dor-2012ok.pdf'
			elseif certyear == 2013 then
				return ({
					album = 'https://www.snepmusique.com/wp-content/uploads/2014/02/Certifications_Albums_2013.pdf',
					single = 'https://www.snepmusique.com/wp-content/uploads/2014/02/Certifications_Single_2013.pdf',
					video = 'https://www.snepmusique.com/wp-content/uploads/2014/02/Certifications_Vid%C3%A9o_2013.pdf',
				})[type] or {'MISSING OR INVALID type WAS PROVIDED FOR FRANCE CERTIFICATION.'}
			end
		
			local award = mw.ustring.lower(args.award or '')
			local number = tonumber(args.number)
		
			local typeId = ({
				album = ({
					silver = 28,
					gold = number == 2 and 11 or 8,
					platinum = ({
						[2] = 13,
						[3] = 14,
					})[number] or 12,
					diamond = 15,
				})[award],
				single = ({
					silver = 6,
					gold = 7,
					platinum = 9,
					diamond = 10,
				})[award],
				video = ({
					gold = 16,
					platinum = ({
						[2] = 18,
						[3] = 19,
					})[number] or 17,
					diamond = 20,
				})[award],
				compilation = ({
					silver = 29,
					gold = number == 2 and 23 or 22,
					platinum = ({
						[2] = 25,
						[3] = 26,
					})[number] or 24,
					diamond = 27,
				})[award],
			})[type]

			if not typeId then
				return {'MISSING OR INVALID type WAS PROVIDED FOR FRANCE CERTIFICATION.'}
			end
		
			return 'https://www.snepmusique.com/fr/pag-259165-CERTIFICATIONS.html?year='
				.. (certyear or '')
				.. '&type=' .. typeId
		else
			return 'http://snepmusique.com/les-certifications/?categorie='
				.. ({
					album = 'Albums',
					compilation = 'Albums',
					single = 'Tout',
					video = 'Vidéos',
				})[type] or 'Tout'
				.. '&interprete=' .. mw.uri.encode(args.artist or '')
				.. '&titre=' .. mw.uri.encode(args.title or '')
		end
	end,
	
	gcc = function(_, certyear)
		return ({
			[2009] = 'https://web.archive.org/web/20131010193203/http://www.ifpi.org/content/section_news/mid_east_2009.html',
			[2010] = 'https://web.archive.org/web/20131021203829/http://www.ifpi.org/content/section_news/mid_east_2010.html',
			[2011] = 'https://web.archive.org/web/20140111183325/http://www.ifpi.org/content/section_news/mid_east_2011.html',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
				.. 'PROVIDED FOR GCC CERTIFICATION.'})
	end,
	
	germany = function(args)
		if notblank(args.artist) or notblank(args.title) then
			local type = mw.ustring.lower(args.type or '')
	
			return 'https://www.musikindustrie.de/wie-musik-zur-karriere-werden-kann/markt-bestseller/gold-/platin-und-diamond-auszeichnung/datenbank/?action=suche'
				.. '&strTitel=' .. mw.uri.encode(args.title or '')
				.. '&strInterpret=' .. mw.uri.encode(args.artist or '')
				.. '&strTtArt=' .. ({
					album = '2',
					single = '1',
					video = '56',
				})[type] or 'alle'
				.. '&strAwards=' .. (yesno(args.best) and 'checked' or 'unchecked')
		end
	
		return 'https://www.musikindustrie.de/wie-musik-zur-karriere-werden-kann/markt-bestseller/gold-/platin-und-diamond-auszeichnung/datenbank'
	end,
	
	greece = function(args, certyear)
		if isblank(args.id) then
			return {'MISSING id FOR GREECE CERTIFICATION.'}
		end
		
		local url = 'https://web.archive.org/web/' .. args.id .. '/'
	
		if certyear and certyear >= 2021 then
			return url .. (yesno(args.domestic)
				and 'https://www.ifpi.gr/digital_el.html'
				or 'https://www.ifpi.gr/digital_iel.html')
		end

		local typeId = ({
			album = (certyear and certyear < 2010)
				and (yesno(args.domestic) and '5' or '1')
				or '1',
			single = '3',
			video = '6',
		})[mw.ustring.lower(args.type or '')]

		if not typeId then
			return {'MISSING OR INVALID type WAS PROVIDED FOR GREECE CERTIFICATION.'}
		end
	
		return url .. 'https://www.ifpi.gr/chart0' .. typeId .. '.htm'
	end,

	['hong kong'] = function(_, certyear)
		return ({
			[2008] = 'https://web.archive.org/web/20120318015308/http://www.ifpihk.org/www_1/go30e.php',
			[2007] = 'https://web.archive.org/web/20120318013701/http://www.ifpihk.org/www_1/go28e.php',
			[2002] = 'https://web.archive.org/web/20120318013656/http://www.ifpihk.org/www_1/go27e.php',
			[2001] = 'https://web.archive.org/web/20120318013651/http://www.ifpihk.org/www_1/go26e.php',
			[2000] = 'https://web.archive.org/web/20120318015411/http://www.ifpihk.org/www_1/go25e.php',
			[1999] = 'https://web.archive.org/web/20120318015406/http://www.ifpihk.org/www_1/go24e.php',
			[1998] = 'https://web.archive.org/web/20120318013427/http://www.ifpihk.org/www_1/go2e.php',
			[1997] = 'https://web.archive.org/web/20120318015314/http://www.ifpihk.org/www_1/go3e.php',
			[1996] = 'https://web.archive.org/web/20120318013432/http://www.ifpihk.org/www_1/go4e.php',
			[1995] = 'https://web.archive.org/web/20120318015416/http://www.ifpihk.org/www_1/go5e.php',
			[1993] = 'https://web.archive.org/web/20120318013706/http://www.ifpihk.org/www_1/go6e.php',
			[1990] = 'https://web.archive.org/web/20120318013711/http://www.ifpihk.org/www_1/go7e.php',
			[1989] = 'https://web.archive.org/web/20120318013453/http://www.ifpihk.org/www_1/go8e.php',
			[1988] = 'https://web.archive.org/web/20120318015320/http://www.ifpihk.org/www_1/go9e.php',
			[1985] = 'https://web.archive.org/web/20120318013844/http://www.ifpihk.org/www_1/go10e.php',
			[1984] = 'https://web.archive.org/web/20120318015345/http://www.ifpihk.org/www_1/go11e.php',
			[1983] = 'https://web.archive.org/web/20120318013412/http://www.ifpihk.org/www_1/go12e.php',
			[1982] = 'https://web.archive.org/web/20120318015304/http://www.ifpihk.org/www_1/go13e.php',
			[1981] = 'https://web.archive.org/web/20120316222050/http://www.ifpihk.org/www_1/go14e.php',
			[1980] = 'https://web.archive.org/web/20120318015350/http://www.ifpihk.org/www_1/go15e.php',
			[1979] = 'https://web.archive.org/web/20120318013417/http://www.ifpihk.org/www_1/go16e.php',
			[1978] = 'https://web.archive.org/web/20120318015404/http://www.ifpihk.org/www_1/go17e.php',
			[1977] = 'https://web.archive.org/web/20120318013422/http://www.ifpihk.org/www_1/go18e.php',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
			.. 'PROVIDED FOR HONG KONG CERTIFICATION.'})
	end,
	
	hungary = function(_, certyear)
		return 'https://slagerlistak.hu/arany-es-platinalemezek/adatbazis/' .. (certyear or '')
	end,
	
	ireland = function(args, certyear)
		local page = 'index'
		
		if certyear then
			local award = mw.ustring.lower(args.award or '')
			local type
			if award == 'gold' then
				type = 'gold'
			elseif tonumber(args.number) then
				type = 'multi_platinum'
			else
				type = 'platinum'
			end
	
			page =  type .. (certyear == 2005 and '' or string.format('%02d', certyear - 2000))
		end
	
		return 'http://www.irishcharts.ie/awards/' .. page .. '.htm'
	end,
	
	italy = function(args)
		if notblank(args.id) then
			return 'https://www.fimi.it/top-of-the-music/targhette/richiedi-targhetta/?id=' .. args.id
		elseif notblank(args.title) then
			return 'https://www.fimi.it/top-of-the-music/music/?title=' .. mw.uri.encode(args.title)
		elseif notblank(args.artist) then
			return 'https://www.fimi.it/top-of-the-music/artist/?title=' .. mw.uri.encode(args.artist)
		end
	
		return 'https://www.fimi.it/top-of-the-music/certificazioni/'
	end,
	
	japan = function(args)
		local type = mw.ustring.lower(args.type or '')
	
		if yesno(args.digital) then
			return 'https://www.riaj.or.jp/f/data/cert/hs.html'
		elseif yesno(args.streaming) then
			return 'https://www.riaj.or.jp/f/data/cert/st.html'
		elseif type == 'ringtone' then
			return 'https://www.riaj.or.jp/f/data/cert/hs.html'
		end
	
		return 'https://www.riaj.or.jp/f/data/cert/gd.html'
	end,
	
	mexico = function()
		return 'https://amprofon.com.mx/es/pages/certificaciones.php'
	end,
	
	netherlands = function()
		return 'https://www.goudplatina.nl/database'
	end,
	
	['new zealand'] = function(args, _, source)
		if isblank(args.type) then
			return {'MISSING type FOR NEW ZEALAND CERTIFICATION.'}
		end
		
		local type = mw.ustring.lower(args.type)
		
		local typeParam
	
		if source == 'archive' then
			typeParam = ({
				single = 'id=77&Itemid=61',
				album = 'id=79&Itemid=62',
				video = 'id=75&Itemid=65',
			})[type]
			
			if not typeParam then
				return {'MISSING OR INVALID type WAS PROVIDED FOR NEW ZEALAND CERTIFICATION.'}
			end
			
			return 'http://www.radioscope.net.nz/index.php?option=com_content&task=view&' .. typeParam
		elseif source == 'newchart' then
			if isblank(args.id) then
				return {'MISSING id FOR NEW ZEALAND CERTIFICATION.'}
			end
			typeParam = ({
				album = yesno(args.domestic) and 'aotearoa-albums' or 'albums',
				single = yesno(args.domestic) and 'aotearoa-singles' or 'singles',
			})[type]
			if not typeParam then
				return {'MISSING OR INVALID type WAS PROVIDED FOR NEW ZEALAND CERTIFICATION.'}
			end
			return 'https://aotearoamusiccharts.co.nz/archive/' .. typeParam .. '/' .. args.id
		elseif source == 'radioscope' then
			typeParam = ({
				album = 'album',
				single = 'single',
			})[type]
			if not typeParam then
				return {'MISSING OR INVALID type WAS PROVIDED FOR NEW ZEALAND CERTIFICATION.'}
			end
			return 'https://www.radioscope.co.nz/2024/00/00/' .. typeParam .. '-cert-search/'
		else -- 'oldchart' or blank source
			if isblank(args.id) then
				return {'MISSING id FOR NEW ZEALAND CERTIFICATION.'}
			end
			typeParam = ({
				album = yesno(args.domestic) and 'nzalbums' or 'albums',
				compilation = 'compilations',
				single = yesno(args.domestic) and 'nzsingles' or 'singles',
			})[type]
			if not typeParam then
				return {'MISSING OR INVALID type WAS PROVIDED FOR NEW ZEALAND CERTIFICATION.'}
			end
			return 'https://nztop40.co.nz/chart/' .. typeParam .. '?chart=' .. args.id
		end
	end,
	
	nigeria = function()
		return 'https://www.turntablecharts.com/certification'
	end,
	
	norway = function(args, certyear)
		if certyear and certyear < 2011 then
			return 'https://web.archive.org/web/20121105012246/http://www.ifpi.no/sok/lst_trofeer_sok.asp?type=artist'
		end
	
		return 'https://ifpi.no/trofe/trofeoversikt/'
			.. (notblank(args.artist) and ('?searchterm=' .. mw.uri.encode(args.artist)) or '')
	end,
	
	philippines = function()
		return 'https://www.pari.com.ph/awardsgoldplatinum.html'
	end,
	
	poland = function(args, certyear)
		if (certyear or 2023) <= 2022 then
			local award = mw.ustring.lower(args.award or '')
			local type = mw.ustring.lower(args.type or '')
	
			return 'http://bestsellery.zpav.pl/wyroznienia/'
				.. ({
					gold = 'zlote',
					platinum = 'platynowe',
					diamond = 'diamentowe',
				})[award] or 'zlote'
				.. 'plyty/'
				.. (type == 'video' and 'dvd' or 'cd')
				.. '/archiwum.php?year=' .. certyear
		end
	
		return 'https://www.olis.pl/charts/oficjalna-lista-wyroznien'
	end,
	
	portugal = function(args, certyear, source)
		if certyear and certyear >= 2018 then
			if notblank(args.id) then
				return 'https://www.audiogest.pt/uploads/files/' .. args.id
			end
			return 'https://www.audiogest.pt/tops-vendas'
		end
	
		if source == 'archive' then
			return 'http://www.afp.org.pt/estatisticas.php'
		end
	
		return 'http://www.artistas-espectaculos.com/topafp/pt/'
			.. (notblank(args.id) and (args.id .. '.htm') or '')
	end,
	
	russia = function(args, certyear)
		local award = mw.ustring.lower(args.award or '')
		if award == 'million' then
			return 'https://web.archive.org/web/20110724033119/http://www.2m-online.ru/gold_n_platinum'
		end
	
		return ({
			[2003] = 'https://web.archive.org/web/20090124001144/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5069',
			[2004] = 'https://web.archive.org/web/20090124001134/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5073',
			[2005] = 'https://web.archive.org/web/20090124001149/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5075',
			[2006] = 'https://web.archive.org/web/20090607023006/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5076',
			[2007] = 'https://web.archive.org/web/20090809124202/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5077',
			[2008] = 'https://web.archive.org/web/20090216165239/http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5078',
			[2009] = 'https://webcitation.org/5kkNUOygo?url=http://2m-online.ru/gold_n_platinum/detail.php?COUNTRY=5216',
			[2010] = 'https://web.archive.org/web/20110207025213/https://lenta.ru/articles/2011/02/05/chart/',
			[2011] = 'https://web.archive.org/web/20120310114015/https://lenta.ru/articles/2012/03/09/chart/',
			[2012] = 'https://web.archive.org/web/20130115073750/https://lenta.ru/articles/2012/12/28/chart/',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
			.. 'PROVIDED FOR RUSSIA CERTIFICATION.'})
	end,

	singapore = function()
		return 'https://www.rias.org.sg/rias-accreditations/'
	end,
	
	['south africa'] = function(args)
		return 'https://www.risa.org.za/website/certification/certifications/?artist='
			.. mw.uri.encode(args.artist or '')
			.. '&title=' .. mw.uri.encode(args.title or '')
	end,
	
	['south korea'] = function(args)
		local serviceGbn = (yesno(args.streaming) and 'S1040' or ({
			album = 'ALBUM',
			single = 'S1020',
		})[mw.ustring.lower(args.type or '')])

		if not serviceGbn then
			return {'MISSING OR INVALID type WAS PROVIDED FOR SOUTH KOREA CERTIFICATION.'}
		end
	
		return 'https://circlechart.kr/page_cert/chart.circle?serviceGbn=' .. serviceGbn
	end,
	
	spain = function(args)
		local type = mw.ustring.lower(args.type or '')
	
		if notblank(args.id) then
			return 'https://www.elportaldemusica.es/' .. type .. '/' .. args.id
		elseif notblank(args.certweek) then
			return 'https://www.promusicae.es/listas-semanales/'
		elseif notblank(args.artist) or notblank(args.title) then
			return 'https://www.elportaldemusica.es/awards/index?'
				.. (notblank(args.artist) and 'AwardsSearch%5Bartist%5D=' .. mw.uri.encode(args.artist) or '')
				.. (notblank(args.title) and '&AwardsSearch%5Btitle%5D=' .. mw.uri.encode(args.title) or '')
				.. (notblank(args.type) and '&AwardsSearch%5Bgroup%5D=' .. ({
					single = 'CANCIONES',
					album = 'ALBUMES',
					video = 'DVD',
				})[type] or '')
	
		end
	
		return 'https://www.promusicae.es/listas-semanales/'
	end,
	
	sweden = function(args, certyear, source)
		if source == 'artist' then
			return 'https://www.sverigetopplistan.se/search?query=' .. mw.uri.encode(args.artist or '')
		elseif source == 'chart' then
			if not certyear then
				return {'MISSING OR INVALID certyear WAS PROVIDED FOR SWEDEN CERTIFICATION.'}
			elseif isblank(args.certweek) then
				return {'MISSING certweek FOR SWEDEN CERTIFICATION.'}
			end

			local typeId = ({
				single = '41',
				album = '54',
			})[mw.ustring.lower(args.type or '')]

			if not typeId then
				return {'MISSING OR INVALID type WAS PROVIDED FOR SWEDEN CERTIFICATION.'}
			end
			
			return 'https://www.sverigetopplistan.se/chart/' .. typeId .. '?dspy=' .. certyear .. '&dspp=' .. args.certweek
		elseif source == 'grammotex' then
			return notblank(args.id) and ('http://sys2.grammotex.se/netdata/grp006.mbr/artdata?sart=' .. args.id)
				or {'MISSING id FOR SWEDEN CERTIFICATION.'}
		end
		
		return ({
			[1999] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-19991.pdf',
			[2000] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20002.pdf',
			[2001] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20013.pdf',
			[2002] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20021.pdf',
			[2003] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20033.pdf',
			[2004] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20042.pdf',
			[2005] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20051.pdf',
			[2006] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20061.pdf',
			[2007] = 'http://www.ifpi.se/wp/wp-content/uploads/ar-20071.pdf',
			[2008] = 'http://www.ifpi.se/wp/wp-content/uploads/guld-platina-20082.pdf',
			[2009] = 'http://www.ifpi.se/wp/wp-content/uploads/Guld-Platina-2009.pdf',
			[2010] = 'http://www.ifpi.se/wp/wp-content/uploads/%C3%85r-2010.pdf',
			[2011] = 'http://www.ifpi.se/wp-content/uploads/Guld-Platina-Cert-2011-Artistordning.pdf',
		})[certyear] or (certyear and 'http://www.ifpi.se/wp/wp-content/uploads/guld-platina-1987-1998.pdf'
			or {'MISSING certyear FOR SWEDEN CERTIFICATION.'})
	end,
	
	switzerland = function(args, certyear)
		if notblank(args.title) then
			return 'http://www.swisscharts.com/search_certifications.asp?search=' .. mw.uri.encode(args.title, 'WIKI')
		elseif notblank(args.artist) then
			return 'http://www.swisscharts.com/search_certifications.asp?search=' .. mw.uri.encode(args.artist, 'WIKI')
		end
	
		return 'http://www.swisscharts.com/edelmetall/' .. (certyear or '')
	end,
	
	taiwan = function()
		return 'http://www.rit.org.tw/index.php/our-business/2-6platimun-award/2-6-4certifications-awarded'
	end,
	
	turkey = function(_, certyear)
		return ({
			[2004] = 'http://mu-yap.org/getdata.asp?PID=192',
			[2005] = 'http://www.mu-yap.org/news.asp?NID=114',
			[2006] = 'http://www.mu-yap.org/news.asp?NID=158',
			[2007] = 'http://www.mu-yap.org/news.asp?NID=248',
			[2008] = 'http://www.mu-yap.org/getdata.asp?PID=269',
			[2009] = 'http://www.mu-yap.org/news.asp?NID=279',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
			.. 'PROVIDED FOR TURKEY CERTIFICATION.'})
	end,
	
	['united kingdom'] = function()
		return 'https://www.bpi.co.uk/page/certified-awards'
	end,
	
	['united states'] = function(args)
		local type = mw.ustring.lower(args.type or '')
	
		return 'https://www.riaa.com/gold-platinum/?tab_active=default-award'
			.. '&ar=' .. mw.uri.encode(args.artist or '')
			.. '&ti=' .. mw.uri.encode(args.title or '')
			.. '&format=' .. (({
				album = 'Album',
				single = 'Single',
				video = 'Video+Longform',
				videosingle = 'Video+Single',
				ep = 'short+form+album',
			})[type] or '')
			.. '&type='
			.. (yesno(args.Spanish) and 'LA' or '')
			.. (type == 'ringtone' and 'MT' or '')
			.. '#search_section'
	end,
	
	uruguay = function(_, certyear)
		return ({
			[1999] = 'https://web.archive.org/web/20041201000000/http://www.cudisco.org/premios.htm',
			[2000] = 'https://web.archive.org/web/20041201000000/http://www.cudisco.org/premios.htm',
			[2001] = 'https://web.archive.org/web/20041201000000/http://www.cudisco.org/premios.htm',
			[2002] = 'https://web.archive.org/web/20041201000000/http://www.cudisco.org/premios.htm',
			[2005] = 'https://web.archive.org/web/20070626220456/http://www.cudisco.org/premios05.htm',
			[2006] = 'https://web.archive.org/web/20070630121819/http://www.cudisco.org/premios.htm',
			[2007] = 'https://web.archive.org/web/20080510152342/http://www.cudisco.org/home.htm',
			[2008] = 'https://web.archive.org/web/20090309001551/http://www.cudisco.org/home.htm',
			[2009] = 'https://web.archive.org/web/20100329105701/http://www.cudisco.org/home.htm',
			[2010] = 'https://web.archive.org/web/20110725212429/http://www.cudisco.org/',
			[2011] = 'https://web.archive.org/web/20120213115344/http://www.cudisco.org/',
			[2012] = 'https://web.archive.org/web/20130825055729/http://www.cudisco.org/',
			[2013] = 'https://web.archive.org/web/20140222141339/http://www.cudisco.org/',
			[2014] = 'https://web.archive.org/web/20150801100914/http://cudisco.org/',
			[2015] = 'https://web.archive.org/web/20160504175625/http://www.cudisco.org/',
			[2016] = 'https://web.archive.org/web/20170326075028/http://www.cudisco.org/',
			[2017] = 'https://web.archive.org/web/20180321140110/http://www.cudisco.org/',
			[2018] = 'https://web.archive.org/web/20190327101606/https://www.cudisco.org/',
		})[certyear] or ({(certyear and 'NO URL DATA FOR THE certyear ' or 'MISSING OR INVALID certyear WAS ')
			.. 'PROVIDED FOR URUGUAY CERTIFICATION.'})
	end,
}

return function (args, urlSource)
	local certyear = tonumber(args.certyear)
	local source = notblank(args.source) and args.source or urlSource
	local region = regions[mw.ustring.lower(args.region or '')]
	if not region then return 'Unknown region' end
	
	return region(args, certyear, source)
end