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.
!commands add !howlong $(urlfetch https://2g.be/twitch/followingYT.php)
timezone - Default timezone is UTC, if you want a different timezone use the timezone parameter for example:
Supported timezones here.
notext - If you want to just display the date, instead of the whole “User has been subscribed to Channel since…” add
¬ext 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 https://2g.be/twitch/followingYT.php?format=mwdhms&timezone=America/New_York)
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.