Skip to content

Commit b521a5d

Browse files
committed
YouTubeLiveのエラー処理を強化
1 parent f48a1e3 commit b521a5d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

YouTubeLiveSitePlugin/Test2/VidResolver.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,26 @@ private static dynamic GetVideosTab(dynamic ytInitialData)
4343
}
4444
private static ListType GetType(string ytInitialData)
4545
{
46-
dynamic d = JsonConvert.DeserializeObject(ytInitialData);
47-
var videoTab = GetVideosTab(d);
48-
var arr = videoTab.tabRenderer.content.sectionListRenderer.subMenu.channelSubMenuRenderer.contentTypeSubMenuItems;
49-
foreach (var item in arr)
46+
try
5047
{
51-
var title = (string)item.title;
52-
var selected = (bool)item.selected;
53-
if (selected)
48+
dynamic d = JsonConvert.DeserializeObject(ytInitialData);
49+
var videoTab = GetVideosTab(d);
50+
var arr = videoTab.tabRenderer.content.sectionListRenderer.subMenu.channelSubMenuRenderer.contentTypeSubMenuItems;
51+
foreach (var item in arr)
5452
{
55-
var type = GetTypeByName(title);
56-
return type;
53+
var title = (string)item.title;
54+
var selected = (bool)item.selected;
55+
if (selected)
56+
{
57+
var type = GetTypeByName(title);
58+
return type;
59+
}
5760
}
5861
}
62+
catch (Exception ex)
63+
{
64+
throw new ParseException(ytInitialData, ex);
65+
}
5966
return ListType.Unknown;
6067
}
6168
private static ListType GetTypeByName(string listTypeName)

0 commit comments

Comments
 (0)