2 Commits

Author SHA1 Message Date
38666d5472 List in $USD 2023-08-11 12:53:21 +10:00
71dc2fc768 add file saving capabilities 2023-08-10 01:44:19 -05:00
3 changed files with 29 additions and 7 deletions

View File

@ -1,3 +1,11 @@
# SteamMoneyEstimator
Estimates how much money a piece of software makes on steam using information about its reviews.
Estimates how much money a piece of software makes on steam using information about its reviews.
## Usage
This will save a file locally along with printing the results:
`SteamMoneyEstimator true "https://store.steampowered.com/app/1895350/I_Wani_Hug_that_Gator/"`
This will simply output the results without saving a file locally
`SteamMoneyEstimator true "https://store.steampowered.com/app/1895350/I_Wani_Hug_that_Gator/"`

View File

@ -1,6 +1,6 @@
# Package
version = "1.0.0"
version = "1.0.1"
author = "Michael Yick"
description = "Estimates how much money a piece of software makes on steam using information about its reviews."
license = "AGPL-3.0-only"

View File

@ -4,10 +4,10 @@ import htmlparser
import xmltree
import strutils
import re
import typetraits
var client = newHttpClient()
let steamURL = os.paramStr(1)
let save = parseBool(os.paramStr(1))
let steamURL = os.paramStr(2)
let response = client.getContent(steamURL)
var html = htmlparser.parseHtml(response)
@ -68,12 +68,26 @@ if onSale:
if element.attr("class") == "discount_original_price":
price = element.innerText.replace("$").parseFloat
break
echo "Link: " & os.paramStr(1)
echo "Price: " & $price
echo "Link: " & os.paramStr(2)
echo "Price: $" & ((price.formatFloat(ffDecimal, 2)).insertSep(',')).replace(",.", ".") & " (USD)"
echo "Year of Release: " & yearOfRelease
echo "Year Multiplier (from VG Insights): " & $multiplier
echo "Reviews: " & $reviewCount
let estimatedSales = multiplier*reviewCount
echo "Estimated Sales: " & $estimatedSales
let estimatedRevenue = (toFloat(estimatedSales)*price)*0.70
let estimatedRevenue = "$" & (((toFloat(estimatedSales)*price*0.70).formatFloat(ffDecimal, 2)).insertSep(',')).replace(",.", ".") & " (USD)"
echo "Estimated revenue (including steam cut): " & $estimatedRevenue
if save:
for name in html.findall("span"):
if name.attr("itemprop") == "name":
var output = """
Link: $1
Price: $2
Year of Release: $3
Year Multiplier (from VG Insights): $4
Reviews: : $5
Estimated Sales: $6
Estimated revenue (including steam cut): $7""" % [os.paramStr(2), $price, yearOfRelease, $multiplier, $reviewCount, $estimatedSales, $estimatedRevenue]
writeFile(name.innerText, output)