johnmaguire / Cardinal

A Python IRC bot, designed to make adding functionality quick and simple. (est. 2013)
MIT License
100 stars 38 forks source link

unicode issue in title plugin #171

Closed johnmaguire closed 3 years ago

johnmaguire commented 4 years ago
2020-04-17 22:41:45,943 - cardinal.bot - DEBUG - greghume!~greghume@tor.darkscience.net to #pirates: Virtual: https://www.youtube.com/watch?v=lQ5cUbDHVa4
2020-04-17 22:41:45,943 - cardinal.plugins - DEBUG - Attempting to fire event: irc.privmsg
2020-04-17 22:41:45,943 - cardinal.plugins - DEBUG - Calling 1 callbacks for event: irc.privmsg
2020-04-17 22:41:45,944 - cardinal.plugins - DEBUG - Callback QGE2WS accepted event 'irc.privmsg'
2020-04-17 22:41:45,944 - cardinal.plugins - DEBUG - Attempting to fire event: urls.detection
2020-04-17 22:41:45,945 - cardinal.plugins - DEBUG - Calling 3 callbacks for event: urls.detection
2020-04-17 22:41:45,945 - cardinal.plugins - DEBUG - Callback 8EHU2X rejected event 'urls.detection'
2020-04-17 22:41:45,946 - cardinal.plugins - DEBUG - Callback RU550F rejected event 'urls.detection'
2020-04-17 22:41:46,153 - plugins.youtube.plugin - ERROR - Failed to fetch info for lQ5cUbDHVa4'
Traceback (most recent call last):
  File "/usr/src/app/plugins/youtube/plugin.py", line 102, in _get_video_info
    result = self._form_request("videos", params)
  File "/usr/src/app/plugins/youtube/plugin.py", line 121, in _form_request
    urllib.urlencode(params))
  File "/usr/local/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/local/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
2020-04-17 22:41:46,156 - cardinal.plugins - DEBUG - Callback FKXPOW rejected event 'urls.detection'
2020-04-17 22:41:46,862 - cardinal.plugins - ERROR - Unhandled error: [Failure instance: Traceback: <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py:460:callback
/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py:1475:gotResult
--- <exception caught here> ---
/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py:1418:_inlineCallbacks
/usr/src/app/plugins/urls/plugin.py:108:get_title
]
johnmaguire commented 3 years ago

Not sure what caused this, but I think it's related to the 403. After the recent switch to Python 3, we'll see if this crops up again.