{"id":158,"date":"2023-01-23T10:00:00","date_gmt":"2023-01-23T18:00:00","guid":{"rendered":"https:\/\/dejal.com\/blog\/?p=158"},"modified":"2023-01-12T09:47:16","modified_gmt":"2023-01-12T17:47:16","slug":"using-simon-to-watch-youtube-subscriber-counts","status":"publish","type":"post","link":"https:\/\/dejal.com\/blog\/using-simon-to-watch-youtube-subscriber-counts\/","title":{"rendered":"Using Simon to watch YouTube subscriber counts"},"content":{"rendered":"<body><p><\/p>\n<p>A customer sent a query, asking how to use <a href=\"https:\/\/dejal.com\/simon\/\">Simon<\/a> to monitor the subscriber counts on YouTube channels.<\/p>\n<p>This is easy for Simon to do, by having <strong>Web Page<\/strong>\u00a0tests for each YouTube channel, each with a filter to extract the subscriber count, and whatever notifier you wish.<\/p>\n<p>The first step is to add a <strong>Web Page<\/strong>\u00a0test for a YouTube channel, and look at the HTML output in the <strong>Preview<\/strong> pane, to find how the subscriber count appears.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Test\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.09.38.png?resize=1023%2C821&#038;ssl=1\" alt=\"Test\" width=\"1023\" height=\"821\" border=\"0\" loading=\"lazy\"><\/p>\n<p>For example, for my <a href=\"https:\/\/www.youtube.com\/@SinclairTrails\">Sinclair Trails channel<\/a>, the HTML includes:<\/p>\n<p><code>\u00a0 \u00a0 \"subscriberCountText\":{\"accessibility\":{\"accessibilityData\":{\"label\":\"30 subscribers\"}},\"simpleText\":\"30 subscribers\u201d},<\/code><\/p>\n<p>Yes, I currently only have 30 subscribers\u2026 rather sad. Please subscribe to help me reach a more respectable number!<\/p>\n<p>A sensible default choice for a filter is the <strong>Block<\/strong> one, though in this case a better choice would be the <strong>Find Regular Expression<\/strong>\u00a0filter. 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\u2019t have to configure the notifier for each test.<\/p>\n<p>A regular expression to extract the subscriber count from that HTML could be:<\/p>\n<p><code>\u00a0 \u00a0 subscriberCountText.+?simpleText\\\":\\\"(.+?)\\\u201d\\}<\/code><code><\/code><\/p>\n<p>This will look for text starting with \u201c<code>subscriberCountText<\/code>\u201d, some more text, then \u201c<code>simpleText\u201d:\"<\/code>\u201d , then capture the desired text up until \u201c<code>\u201d\\}<\/code>\u201d .<\/p>\n<p>In my case, that will result in:<\/p>\n<p><code>\u00a0 \u00a0 30 subscribers<\/code><\/p>\n<p>To make a new filter for this, you can go to the <strong>Filters<\/strong> page in Simon, and add a new filter named \u201cYouTube subscribers\u201d (or whatever you prefer).<\/p>\n<p>Then choose <strong>Find<\/strong> for the <strong>Filter Kind<\/strong>, and <strong>Regular Expression<\/strong> from the find options menu:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Find options\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.05.04.png?resize=410%2C345&#038;ssl=1\" alt=\"Find options\" width=\"410\" height=\"345\" border=\"0\" loading=\"lazy\"><\/p>\n<p>Then enter the expression as the find text, and choose <strong>Capture 1<\/strong> as the output:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Custom filter\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-10.44.59.png?resize=770%2C394&#038;ssl=1\" alt=\"Custom filter\" width=\"770\" height=\"394\" border=\"0\" loading=\"lazy\"><\/p>\n<p>Click <strong>Done<\/strong>, then go back to your YouTube test, and choose this new filter on the <strong>Filters<\/strong> page:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Test filters\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.07.44.png?resize=765%2C197&#038;ssl=1\" alt=\"Test filters\" width=\"765\" height=\"197\" border=\"0\" loading=\"lazy\"><\/p>\n<p>This will output just the subscriber count:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Filter output\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.16.34.png?resize=397%2C148&#038;ssl=1\" alt=\"Filter output\" width=\"397\" height=\"148\" border=\"0\" loading=\"lazy\"><\/p>\n<p>You can see this output in the <strong>Activity<\/strong> log:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Activity log\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.18.21.png?resize=831%2C185&#038;ssl=1\" alt=\"Activity log\" width=\"831\" height=\"185\" border=\"0\" loading=\"lazy\"><\/p>\n<p>Or you can add a new <strong>Email<\/strong> notifier to email the filter output using the <code>{FilterOutputText}<\/code> variable:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Email notifier\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.22.08.png?resize=776%2C298&#038;ssl=1\" alt=\"Email notifier\" width=\"776\" height=\"298\" border=\"0\" loading=\"lazy\"><\/p>\n<p>And of course use that notifier in your test, along with whatever other notifiers you wish:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"Test notifiers\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.23.46.png?resize=767%2C177&#038;ssl=1\" alt=\"Test notifiers\" width=\"767\" height=\"177\" border=\"0\" loading=\"lazy\"><\/p>\n<p>Then you can add more tests for other YouTube channels you want to monitor, specifying your <strong>YouTube subscribers<\/strong> filter for each. For example, <a href=\"https:\/\/www.youtube.com\/@cgpgrey\">CGP Grey<\/a> has a few more subscribers than me:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" title=\"CGP Grey test\" src=\"https:\/\/i0.wp.com\/dejal.com\/blog\/wp-content\/uploads\/2023\/01\/Screenshot-2023-01-05-at-11.27.05.png?resize=912%2C161&#038;ssl=1\" alt=\"CGP Grey test\" width=\"912\" height=\"161\" border=\"0\" loading=\"lazy\"><\/p>\n<p>I hope this helps!<\/p>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>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\u00a0tests 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,4],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-faq","category-simon"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":1,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":159,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions\/159"}],"wp:attachment":[{"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dejal.com\/blog\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}