viewer-subscriber-counter (Youtube and Twitch)

OBS Python viewer-subscriber-counter (Youtube and Twitch) 0.2

1700441810834.png

Overview​

This OBS script displays live viewer counts on YouTube and Twitch, as well as the total number of YouTube subscribers and Twitch followers. It was originally developed for a client but has been expanded and improved for broader use.

Note: The YouTube subscriber count may not be exact for channels with over 1,000 subscribers, as the count is rounded due to limitations in Google's API. (because Google takes your data, but doesn't want to provide it back)

Features​

  • Live viewer count from YouTube and Twitch.
  • Subscriber count from YouTube and follower count from Twitch.
  • Separate or combined text sources for YouTube and Twitch statistics.

Limitations​

Due to YouTube API rate limits, care should be taken with the frequency of API calls. Google provides 10,000 points daily. A search call costs 100 points, and regular updates for viewers and subscribers consume 2 points per minute.

Installation

1. Prerequisites​

- Active accounts on YouTube and Twitch.
- OBS 29 installed.
- Python 3.10.6 installed and added to PATH.

Setup Guide

YouTube​

1. Channel ID: Your YouTube channel ID is required (not the channel name). Find it at YouTube Account Advanced or for any channel using Comment Picker.
2. API Key: Follow this tutorial by WebbyFan: YouTube API Key Tutorial

Twitch​

1. Channel Name: This is your Twitch channel name as it appears in your Twitch channel URL.
2. API Key and Secret: Follow this tutorial by CaptZorro: Twitch API Key Tutorial

Script Configuration​

1. Create text sources in OBS for YouTube and Twitch viewers and subscribers.
2. In OBS, go to Tools > Scripts and add the script.
3. Configure the script settings with your API keys, channel IDs, and text sources.
4. Start your stream on YouTube and Twitch.
5. Click the START button to begin fetching data.

Usage​

- The script updates viewer and subscriber counts every 60 seconds.
- Press the START button after you started streaming to initialize data fetching.
- Logs are stored in the same directory as the script for troubleshooting.

Platform Compatibility​

- Windows: Works on my machine.
- macOS: I helped a client run this script successfully on an Apple M1 laptop, but this was tedious because it is hard to make OBS find the right version of Python on Mac. I don't have a Mac machine, so I can't really help with this. Also, I've added logs since this time, so I don't know how Apple handles the creation of text files in their system by OBS scripts.

Contributing​

Your suggestions and contributions are welcome! Please feel free to leave feature requests or issues on GitHub, and I'll try to implement them.

Limitations and Points to Note​

- Pressing the START button consumes 100 API points each time due to a search call to the YouTube API. It's advisable to use this button sparingly (ideally only once at the start of each stream).
- Running the script continuously for 24 hours will consume approximately 2,880 points, well within the daily limit provided by Google, assuming the START button is not overused.

Acknowledgements​

- Thanks to WebbyFan and CaptZorro for their tutorials on API key setup.
- A big thanks to hmeneses and his Youtube chat and channel updater for the idea of using urllib.request instead of requests

Contact​

For support or inquiries, please open an issue on GitHub or contact me at me at sokolov.teach@gmail.com
  • 1699995340405.png
    1699995340405.png
    56.6 KB · Views: 704
Author
sokolov.teach
Downloads
1,233
Views
7,461
First release
Last update
Rating
0.00 star(s) 0 ratings

Latest updates

  1. Separate Text Sources for YouTube & Twitch and removing 'requests' Module:

    New Features: Separate Text Sources for YouTube & Twitch: Now, you have the option to display...
Top