hit-counter icon indicating copy to clipboard operation
hit-counter copied to clipboard

Solved: How to Query Raw Counts from Command Line

Open JamesDBartlett3 opened this issue 1 year ago • 0 comments

Here's how you can retrieve the raw count data from the command line using PowerShell:

$response = Invoke-WebRequest -Uri "https://hits.seeyoufarm.com/api/count/keep/badge.svg?url=https://your-website.com"
$content = $response.Content
$counts = ($content | Select-String -Pattern "[0-9]+ / [0-9]+" -All).Matches[0].Value
Write-Host "Counts: $counts"

image

The history graph data can be queried in a similar fashion using this endpoint: https://hits.seeyoufarm.com/api/count/graph/dailyhits.svg?url=https://your-website.com You'll need to do a lot of RegEx parsing to pull the historical data out of the SVG code, but the general principle is the same as my prior example above.

JamesDBartlett3 avatar May 29 '23 21:05 JamesDBartlett3