Module:SiteList: Difference between revisions

Jump to navigation Jump to search
3,272 bytes removed ,  23 July 2023
no edit summary
No edit summary
No edit summary
local p = {}
 
local sites = {
website1 = {
label = 'Website 1',
sitetype = 'website',
aliases = {'website1', 'website1.com', 'website1com'},
url = 'https://website1.com/',
sceneUrl = 'https://website1.com/updates/',
modelUrl = 'https://website1.com/models/',
suffix = '?ats=eyJhIjoyOTQwNzMsImMiOjU3MTMxNDM3LCJuIjoyMiwicyI6MjA2LCJlIjo3NzczLCJwIjoyfQ==',
category = {'Website 1 models', 'Website 1 Videos', 'Website 1 Performers'},
network = 'Network1 Network',
},
website2 = {
label = 'Website 2',
sitetype = 'website',
aliases = {'website2', 'website2.com', 'website2com'},
url = 'https://website2.com/',
sceneUrl = 'https://website2.com/scene/',
modelUrl = 'https://website2.com/people/',
suffix = '',
category = 'Website 2 models',
network = 'Network2 Network',
},
website3 = {
label = 'Website 3',
sitetype = 'studio',
aliases = {'website3', 'website3.com', 'website3com'},
url = 'https://website3.com/',
sceneUrl = 'https://website3.com/videos/',
modelUrl = 'https://website3.com/performers/',
suffix = '.html',
category = 'Website 3 models',
network = 'Network3 Network',
list = 'List of Website3 actors',
},
website4 = {
label = 'Website 4',
sitetype = 'website',
aliases = {'website4', 'website4.com', 'website4com'},
url = 'https://website4.com/',
sceneUrl = 'https://website4.com/videos/',
modelUrl = 'https://website4.com/performers/',
suffix = '.html',
category = 'Website 4 models',
network = '',
},
website5 = {
label = 'Website 5',
sitetype = 'studio',
aliases = {'website5', 'website5.com', 'website5com'},
url = 'https://website5.com/',
sceneUrl = '',
modelUrl = 'https://website5.com/models/',
suffix = '',
category = 'Website 5 models',
network = 'Network5 Network',
},
website6 = {
label = 'Website 6',
sitetype = 'website',
aliases = {'website6', 'website6.com', 'website6com'},
url = '',
sceneUrl = '',
modelUrl = '',
suffix = '',
category = '',
network = '',
},
website7 = {
label = 'Website 7',
sitetype = 'website',
aliases = {'website7', 'website7.com', 'website7com'},
url = 'https://website7.com/',
sceneUrl = 'https://website7.com/videos/',
modelUrl = 'https://website7.com/performers/',
suffix = '?ats=eyJhIjoyOTQwNzMsImMiOjU3MTMxNDM3LCJuIjoyMiwicyI6MjA2LCJlIjo3NzczLCJwIjoyfQ==',
category = 'Website 7 models',
network = 'Network7 Network',
idtonum = 'y',
list = 'List of Website7 actors',
},
website8 = {
label = 'Website 8',
sitetype = 'website',
aliases = {'website8', 'website8.com', 'website8com'},
url = 'https://website8.com/',
sceneUrl = 'https://website8.com/videos/',
modelUrl = 'https://website8.com/performers/',
suffix = '?ats=eyJhIjoyOTQwNzMsImMiOjU3MTMxNDM3LCJuIjoyMiwicyI6MjA2LCJlIjo3NzczLCJwIjoyfQ==',
category = 'Website 8 models',
network = 'Network8 Network',
idtonum = '',
list = '',
archiveURL = 'https://archive.ph/sBCAl',
archived = 'y',
},
website9 = {
label = 'Website 9',
sitetype = 'website',
aliases = {'website9', 'website9.com', 'website9com'},
url = 'https://website9.com/',
sceneUrl = 'https://website9.com/videos/',
modelUrl = 'https://website9.com/performers/',
suffix = '?ats=eyJhIjoyOTQwNzMsImMiOjU3MTMxNDM3LCJuIjoyMiwicyI6MjA2LCJlIjo3NzczLCJwIjoyfQ==',
category = 'Website 9 models',
network = 'Network9 Network',
idtonum = 'y',
list = 'List of Website9 actors',
archiveURL = 'https://archive.ph/NSAHAga',
archived = 'y',
},
}
 
function p.site(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:SiteList'})
local site, error = getSite(args.site)
 
if siteerror then
return string.format('|-\n| colspan="4" style="text-align:center;vertical-align:middle;color:red;font-weight:bold;" | %s \n| style="width: 0px; padding: 0px; border: none;" |\n', error)
elseif site then
local url = site.url
local isArchived = site.archived and (site.archived == 'yes' or site.archived == 'y')
 
function getSite(name)
local firstLetter = name:sub(1, 1):upper()
for _, site in pairs(sites) do
local success, siteDictModule = pcall(require, 'Module:SiteDict/' .. firstLetter)
if site.label:lower() == name:lower() or table.contains(site.aliases, name:lower()) then
 
return site
if success then
local matchedSites = {}
for _, site in pairs(siteDictModule.sites) do
if site.label:lower() == name:lower() or table.contains(site.aliases, name:lower()) then
table.insert(matchedSites, site)
end
end
 
if #matchedSites > 1 then
return nil, 'Error: Duplicate sites found in module. Please check the module for errors.'
elseif #matchedSites == 1 then
return matchedSites[1]
end
else
mw.log('Could not load module: ' .. 'Module:SiteDict/' .. firstLetter)
end
 
return nil
end

Navigation menu