🏡 index : ~doyle/dave.git

author dave <dave@ip-172-26-11-212.eu-west-2.compute.internal> 2019-03-03 23:50:35.0 +00:00:00
committer dave <dave@ip-172-26-11-212.eu-west-2.compute.internal> 2019-03-03 23:50:35.0 +00:00:00
commit
ee18c0c8835e485f00777930d4fbc18fe2df8907 [patch]
tree
fdaed0d13aae25ebb95a54036843b694701ca911
parent
2ec55d8216359b84b108d6d25a4e08483ad46d35
download
ee18c0c8835e485f00777930d4fbc18fe2df8907.tar.gz

youtube has upgraded their api or something



Diff

 dave/modules/youtube.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dave/modules/youtube.py b/dave/modules/youtube.py
index ec39881..b1c3531 100644
--- a/dave/modules/youtube.py
+++ a/dave/modules/youtube.py
@@ -11,9 +11,9 @@
BASE_URL = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet," \
           "statistics&key={}".format(dave.config.config["api_keys"]["youtube"])

@dave.module.match(r'.*https?://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)([\w\-\_]*)(&(amp;)?[\w\=]*)?.*')
@dave.module.dont_always_run_if_run()
@dave.module.ratelimit(1, 1)
# @dave.module.match(r'.*https?://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)([\w\-\_]*)(&(amp;)?[\w\=]*)?.*')
# @dave.module.dont_always_run_if_run()
# @dave.module.ratelimit(1, 1)
def youtubevideo(bot, args, sender, source):
    """Ran whenever a YouTube video is sent"""
    if not dave.config.redis.exists("youtube:{}".format(args[0])):
@@ -21,7 +21,7 @@
                  headers={'user-agent': 'irc bot (https://github.com/w4)'})

        if req.status_code != 200:
            bot.msg(source, "Bad response from YouTube API: {}".format(req.status_code))
            print("{} from YouTube API: {}", req.status_code, req.json())
            return

        req = req.json()
@@ -52,4 +52,4 @@
                intcomma(resp["statistics"]["dislikeCount"])
            )
        ]
    ))
    ))