Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
9bf9f0d2e8 | |||
f068b34d81 |
@ -11,11 +11,8 @@ if save == "csv":
|
||||
writeFile("games.csv", "link,price,yearOfRelease,multiplier,reviewCount,estimatedSales,estimatedRevenue\n")
|
||||
let commandLine = os.commandLineParams()
|
||||
let steamURLS = commandLine[1..paramCount()-1]
|
||||
var response: string
|
||||
var steamURL: string
|
||||
|
||||
for steamURL in steamURLS:
|
||||
response = client.getContent(steamURL)
|
||||
let response = client.getContent(steamURL)
|
||||
|
||||
var html = htmlparser.parseHtml(response)
|
||||
|
||||
@ -66,8 +63,6 @@ for steamURL in steamURLS:
|
||||
multiplier = 31
|
||||
of "2023":
|
||||
multiplier = 31
|
||||
of "2024":
|
||||
multiplier = 31
|
||||
|
||||
if onSale:
|
||||
let steamID = steamURL.split("/")[4]
|
||||
@ -108,85 +103,3 @@ for steamURL in steamURLS:
|
||||
echo "Reviews: " & $reviewCount
|
||||
echo "Estimated Sales: " & $estimatedSales
|
||||
echo "Estimated revenue (including steam cut): " & $estimatedRevenue
|
||||
|
||||
var html = htmlparser.parseHtml(response)
|
||||
|
||||
var reviewCount: int
|
||||
var price: float
|
||||
var onSale: bool
|
||||
var yearOfRelease: string
|
||||
var multiplier: int
|
||||
|
||||
for meta in html.findall("meta"):
|
||||
case meta.attr("itemprop"):
|
||||
of "reviewCount":
|
||||
reviewCount = parseInt(meta.attr("content"))
|
||||
of "price":
|
||||
price = parseFloat(meta.attr("content"))
|
||||
case meta.attr("property"):
|
||||
of "og:title":
|
||||
if re.find(meta.attr("content"), re"Save .[0-100]% on.*") == -1:
|
||||
onSale = false
|
||||
else:
|
||||
onSale = true
|
||||
|
||||
for date in html.findall("div"):
|
||||
if date.attr("class") == "date":
|
||||
yearOfRelease = date.innerText.split(" ")[2]
|
||||
|
||||
## https://vginsights.com/insights/article/how-to-estimate-steam-video-game-sales
|
||||
case yearOfRelease:
|
||||
of "2013":
|
||||
multiplier = 79
|
||||
of "2014":
|
||||
multiplier = 72
|
||||
of "2015":
|
||||
multiplier = 62
|
||||
of "2016":
|
||||
multiplier = 52
|
||||
of "2017":
|
||||
multiplier = 43
|
||||
of "2018":
|
||||
multiplier = 38
|
||||
of "2019":
|
||||
multiplier = 36
|
||||
of "2020":
|
||||
multiplier = 31
|
||||
of "2021":
|
||||
multiplier = 31
|
||||
of "2022": ## From here onward, multiplier are made up based off instinct alone
|
||||
multiplier = 31
|
||||
of "2023":
|
||||
multiplier = 31
|
||||
|
||||
if onSale:
|
||||
let steamID = steamURL.split("/")[4]
|
||||
let response = client.getContent("https://store.steampowered.com/widget/" & steamID)
|
||||
let widget = htmlparser.parseHTML(response)
|
||||
for element in widget.findall("div"):
|
||||
if element.attr("class") == "discount_original_price":
|
||||
price = element.innerText.replace("$").parseFloat
|
||||
break
|
||||
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).formatFloat(ffDecimal, 2)).insertSep(',')).replace(",.", ".") & " (USD)"
|
||||
echo "Estimated revenue (including steam cut): " & $estimatedRevenue
|
||||
|
||||
if save == "csv":
|
||||
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)
|
||||
|
Reference in New Issue
Block a user