2012-09-05, 09:35
My Youtube plugin (v 3.1.0) was similarly broken on search and browse. I managed to fix the issue and am now happily watching videos. First, the fix, then the logs (for those of you who think you might have the same problem). This appears to have already been fixed upstream.
The Fix:
Change line 841 of YouTubeCore.py (addons/plugin.video.youtube/YouTubeCore.py):
Old:
if res[i]:
New:
if (len(res) > i) and res[i]:
For the diff-inclined among you:
--- YouTubeCore.py.old 2012-09-05 00:25:26.473877693 -0700
+++ YouTubeCore.py 2012-09-05 00:25:35.279077502 -0700
@@ -838,7 +838,7 @@
i = 0
for item in ytobjects:
if "videoid" in item:
- if res[i]:
+ if (len(res) > i) and res[i]:
item["Overlay"] = res[i]
i += 1 # This can NOT be enumerated because there might be missing videoids
return ytobjects
The Logs (xbmc.log):
00:06:17 T:1276322912 NOTICE: [YouTube-3.1.0] getYTCache : 'Length mismatch:'' -['dMH0bHeiRNg', 'inLBPVG8oEU', '2laujomh0JY', '7bP06EJniVs', 'yHRk2v5MtE4', 'MOiQy9koW20', 'fTPWtYqaHl4', 'DC76VwKtz4M', 'LIckScLy
00:06:17 T:1276322912 INFO: -->Python script returned the following error<--
00:06:17 T:1276322912 ERROR: Error Type: <type 'exceptions.IndexError'>
00:06:17 T:1276322912 ERROR: Error Contents: string index out of range
00:06:17 T:1276322912 ERROR: Traceback (most recent call last):
File "/storage/.xbmc/addons/plugin.video.youtube/default.py", line 108, in <module>
navigation.listMenu(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeNavigation.py", line 108, in listMenu
return self.list(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeNavigation.py", line 191, in list
(results, status) = self.feeds.list(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeFeeds.py", line 157, in list
videos = self.core.getVideoInfo(result["content"], params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeCore.py", line 962, in getVideoInfo
self.getYTCache("vidstatus-", ytobjects, "Overlay")
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeCore.py", line 841, in getYTCache
if res[i]:
IndexError: string index out of range
The Fix:
Change line 841 of YouTubeCore.py (addons/plugin.video.youtube/YouTubeCore.py):
Old:
if res[i]:
New:
if (len(res) > i) and res[i]:
For the diff-inclined among you:
--- YouTubeCore.py.old 2012-09-05 00:25:26.473877693 -0700
+++ YouTubeCore.py 2012-09-05 00:25:35.279077502 -0700
@@ -838,7 +838,7 @@
i = 0
for item in ytobjects:
if "videoid" in item:
- if res[i]:
+ if (len(res) > i) and res[i]:
item["Overlay"] = res[i]
i += 1 # This can NOT be enumerated because there might be missing videoids
return ytobjects
The Logs (xbmc.log):
00:06:17 T:1276322912 NOTICE: [YouTube-3.1.0] getYTCache : 'Length mismatch:'' -['dMH0bHeiRNg', 'inLBPVG8oEU', '2laujomh0JY', '7bP06EJniVs', 'yHRk2v5MtE4', 'MOiQy9koW20', 'fTPWtYqaHl4', 'DC76VwKtz4M', 'LIckScLy
00:06:17 T:1276322912 INFO: -->Python script returned the following error<--
00:06:17 T:1276322912 ERROR: Error Type: <type 'exceptions.IndexError'>
00:06:17 T:1276322912 ERROR: Error Contents: string index out of range
00:06:17 T:1276322912 ERROR: Traceback (most recent call last):
File "/storage/.xbmc/addons/plugin.video.youtube/default.py", line 108, in <module>
navigation.listMenu(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeNavigation.py", line 108, in listMenu
return self.list(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeNavigation.py", line 191, in list
(results, status) = self.feeds.list(params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeFeeds.py", line 157, in list
videos = self.core.getVideoInfo(result["content"], params)
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeCore.py", line 962, in getVideoInfo
self.getYTCache("vidstatus-", ytobjects, "Overlay")
File "/storage/.xbmc/addons/plugin.video.youtube/YouTubeCore.py", line 841, in getYTCache
if res[i]:
IndexError: string index out of range