This repository contains the AWS code and configuration for OSRS Tracker, an application designed to track item prices and player information in the game Old School RuneScape.
-
osrs-tracker_refresh-items
This function fetches all items and latest prices from
prices.runescape.wiki/api/v1/osrs
, merges them into anItem
object and upserts all items to MongoDB every hour. -
osrs-tracker_queue-players
This function fetches all players that have opted in for tracking at a particular UTC offset, and pushes them to a SQS queue where they will wait to be processed.
Calculates current offset from the
ScheduledEvent
and queries MongoDB for players that have opted in for tracking at that specific offset. -
osrs-tracker_process-players
This function fetches OSRS hiscores for the provided usernames, and prepends the hiscore to the
player.hiscoreEntries
array. -
osrs-tracker_hiscore-parser-validator
This function fetches the hiscores every hour for a few test usernames and will run the
parseHiscoreString
function from the@osrs-tracker/hiscores
package to test if the current parser is still valid, and no api changes have happened. -
osrs-tracker_clean-hiscores
This function deletes all hiscores older then 60 days from the data base every day at UTC midnight.
-
osrs-tracker_item-info
When sending a
GET /:id
request, this function returns item details from MongoDB. -
osrs-tracker_item-search
When sending a
GET /:query
request, this function returns items from MongoDB where the name partially matches the provided query. It also adds a confidence score property. -
osrs-tracker_player-hiscores
When sending a
GET /:username(?size=7&skip=0&scrapingOffset=0)
request, this function returns scraped playerhiscoreEntries
for the provided username from MongoDB. -
osrs-tracker_player-info
When sending a
GET /:username(?scrapingOffset=0&hiscore=false)
request, this function returns player information for the provided username from MongoDB, or attempts to scrape it if not found in MongoDB.The
scrapingOffset
will be added to theplayer.scrapingOffsets
if it's not present yet, and will be used filterhiscoreEntries
whenhiscore=true
. An initialhiscoreEntry
will also be pushed if it's the first time the player was fetched with this specificscrapingOffset
.By default, the returned player does not include
hiscoreEntries
. However, if the query parameterhiscore=true
is included in the request, the function will also include the player's most recent hiscore entry matching thescrapingOffset
.The function automatically refreshes the player info when information from MongoDB is older than 2 hours.