Skip to content

Instantly share code, notes, and snippets.

@HudsonGraeme
Created October 29, 2023 18:47
Show Gist options
  • Save HudsonGraeme/ecab488064ce3d952c607c9545f45d3a to your computer and use it in GitHub Desktop.
Save HudsonGraeme/ecab488064ce3d952c607c9545f45d3a to your computer and use it in GitHub Desktop.
Script to aggregate Cogeco bandwidth usage to show usage per-billing period instead of daily.
  1. Open DevTools, Navigate to the Network tab and select fetch/xhr

  2. Navigate to Cogeco's portal https://myaccount.cogeco.ca/acauth/all/internet/usage

  3. Find this network request, select Response and copy the whole contents of the response

image

  1. Navigate to the Console in Devtools and type
const res = 

Then paste your copied response after the equals sign. It should look something like:

const res = {
  appId: "<app id>",
  ...other fields
}
  1. Hit enter to save the res variable. You should see undefined in the console.

image

  1. Copy and paste this code to see aggregated bandwidth usage (Upload and Download) for all billing periods on the account.
Object.fromEntries(res.internetDetailedUsages.locationList[0].productList[0].periodUsageList.map(usageList => [`${new Date(usageList.startDate).toLocaleString('default', { month: 'long' })}-${new Date(usageList.endDate).toLocaleString('default', { month: 'long' })}`, usageList.usageDiscountList[0].usageList.reduce((acc, current) => acc + +current.total, 0)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment