Someone to create a follow check for Youtube?


In April I asked on this forum if there is a way to create a follow check like command and the answer was negative.
Recently I went back on this and found out the Youtube’s API allows you to do exactly that. The only parameter we need is the channel’s ID of the user that called the command. Then Nightbot needs to call the API with some parameters and parse the answer to get the channel in the list.
I could do that but I think it could take me a week since I’m not that experimented with Nightbot, API’s and everything needed for that. Someone’s up to the task ?

Sources :

Basically the Nighbot’s command would be something like

$(urlfetch http://MyAPI%$(userid))

And the API would get the info with a GET request that looks like that

{$(userid)}&forChannelId={Youtuber’s ID}&key={API Key}

The API key being the key used when creating a Google project that is using the Youtube’s API

1 Like

After reading this post and chatting with @Kenshin9977 , I setup a follow/subscribe check for Youtube. It accepts the same parameters as my Twitch followlength command.

Basic command:
!commands add !howlong $(urlfetch

Optional parameters:

  • timezone - Default timezone is UTC, if you want a different timezone use the timezone parameter for example:
    ...&format=d-m-Y H:i:s&timezone=America/New_York

Supported timezones here.

  • notext - If you want to just display the date, instead of the whole “User has been subscribed to Channel since…” add &notext at the end of the url.

  • format - Use this to change the output of the date, there are a bunch of different formats available:

  • &format= (X is following Y since: 15-09-2014 14:40:36) (default)
  • &format=days (X has been following Y for 731 days)
  • &format=daysint (731)
  • &format=months (X has been following Y for 24 months)
  • &format=monthsint (24)
  • &format=ymwdhis(X has been following Y for 1 year, 10 months, 3 weeks, 3 days, 21 hours, 25 minutes, 14 seconds)
  • &format=ymwd(X has been following Y for 1 year, 10 months, 3 weeks, 3 days)
  • &format=mdygia (X has been following Y since 01-31-2005, 5:55 PM)
  • &format=datewd (X has been following Y since 2014-09-15 (105 Weeks, 1 Day))
  • &format=monthday (X has been following Y for 32 months, 30 days)

Or use a PHP date format:
For example: &format=Y-m-d (H:i:s), will return: X has been following Y since 14-09-15 (01:40:36).

You can append these parameters at the end of the url, for example:
!commands add !howlong $(urlfetch

Note: Youtube has a privacy setting which sets the users subscriptions as private information, this setting need to be disabled before a user can check their subscription length. If not disabled, Nightbot will display an error message with instructions how to disable this setting.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.