- setup()
- When
enabled
istrue
in the scrapers config, it will runcreateTimerInterval()
after 5 seconds.
- When
- createTimerInterval()
- Runs
timeIntervalBody()
in a loop, dependent ongetScrapingInterval()
, which per default readsinterval_milliseconds
from the scrapers config.
- Runs
- timeIntervalBody()
- Runs
getScrapingUrl()
, by default readsscraping_url
from scrapers config. - Runs
requestWebsite()
with the given scraping URL. - Runs
parseWebsiteContentToJSON()
with the data given to generate an array of JSON objects from the website content. - Runs
filterNewContent()
with the generated JSON array, marking old content, updating or saving new. - Runs
getSortingFunction()
to sort content after specified arguments. - Runs
getEmbed()
to generate Discord embed for each generated JSON object. - Runs
filterEmbedLength()
to filter length of generated embeds according to Discord's policies. - Runs
sendEmbedMessages()
to send and update new content to subscribed users and guilds, whenglobal_send_embeds
andsend_embeds
aretrue
in configs.
- Runs
{
url: String, // generated from getScrapingUrl()
response: AxiosResponse, // returned from requestWebsite()
content: [
{
json: parsed JSON data, // parsed from parseWebsiteContentToJSON()
newData: Boolean, // determined by filterNewContent()
embed: DiscordEmbed // generated by getEmbed()
},
...
]
}