A customer sent a query, asking how to use Simon to monitor the subscriber counts on YouTube channels.
This is easy for Simon to do, by having Web Page tests for each YouTube channel, each with a filter to extract the subscriber count, and whatever notifier you wish.
The first step is to add a Web Page test for a YouTube channel, and look at the HTML output in the Preview pane, to find how the subscriber count appears.
For example, for my Sinclair Trails channel, the HTML includes:
"subscriberCountText":{"accessibility":{"accessibilityData":{"label":"30 subscribers"}},"simpleText":"30 subscribers”},
Yes, I currently only have 30 subscribers… rather sad. Please subscribe to help me reach a more respectable number!
A sensible default choice for a filter is the Block one, though in this case a better choice would be the Find Regular Expression filter. But if you want to have several tests with the same notifier configuration, an even better choice is to create a new custom notifier, so you don’t have to configure the notifier for each test.
A regular expression to extract the subscriber count from that HTML could be:
subscriberCountText.+?simpleText\":\"(.+?)\”\}
This will look for text starting with “subscriberCountText
”, some more text, then “simpleText”:"
” , then capture the desired text up until “”\}
” .
In my case, that will result in:
30 subscribers
To make a new filter for this, you can go to the Filters page in Simon, and add a new filter named “YouTube subscribers” (or whatever you prefer).
Then choose Find for the Filter Kind, and Regular Expression from the find options menu:
Then enter the expression as the find text, and choose Capture 1 as the output:
Click Done, then go back to your YouTube test, and choose this new filter on the Filters page:
This will output just the subscriber count:
You can see this output in the Activity log:
Or you can add a new Email notifier to email the filter output using the {FilterOutputText}
variable:
And of course use that notifier in your test, along with whatever other notifiers you wish:
Then you can add more tests for other YouTube channels you want to monitor, specifying your YouTube subscribers filter for each. For example, CGP Grey has a few more subscribers than me:
I hope this helps!