Parse authorId from authenticated feeds (#648)

This commit is contained in:
Brahim Hadriche authored and GitHub committed 2025-06-09 19:38:51 -04:00
1 parent fc2ffd8c23
commit 68aeec3d6f
3 files changed
+45 -7

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- [Perf] reverted a perf fix that wasn't helping - [Perf] reverted a perf fix that wasn't helping
- A bug where "Open channel" didn't show up in videos and playlists from logged user
## [0.40.1] - 2025-06-07 ## [0.40.1] - 2025-06-07
@@ -12,12 +12,12 @@ const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20250520.05.00" const INNERTUBE_WEB_CLIENT_VERSION = "2.20250520.05.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0" const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0"
const INNERTUBE_TV_BROWSER_NAME = "LG Browser" const INNERTUBE_TV_BROWSER_NAME = "SamsungBrowser"
const INNERTUBE_TV_BROWSER_VERSION = "7.00.00" const INNERTUBE_TV_BROWSER_VERSION = "9.2"
const INNERTUBE_TV_CLIENT_NAME = "2" const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20250519.12.01" const INNERTUBE_TV_CLIENT_VERSION = "7.20250519.12.01"
const INNERTUBE_TV_DEVICE_MAKE = "LGE" const INNERTUBE_TV_DEVICE_MAKE = "Samsung"
const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU" const INNERTUBE_TV_DEVICE_MODEL = "SmartTV"
const INNERTUBE_TV_OS_NAME = "webOS" const INNERTUBE_TV_OS_NAME = "Tizen"
const INNERTUBE_TV_OS_VERSION = "2015" const INNERTUBE_TV_OS_VERSION = "4.0.0.2"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)" const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15"
@@ -1064,6 +1064,11 @@ namespace Innertube
"percentDurationWatched": percentDurationWatched "percentDurationWatched": percentDurationWatched
} }
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
video["authorId"] = authorId
end if
PushFeedItem(video, context) PushFeedItem(video, context)
return invalid return invalid
end function end function
@@ -1107,6 +1112,11 @@ namespace Innertube
"videoThumbnails": videoThumbnails "videoThumbnails": videoThumbnails
} }
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
video["authorId"] = authorId
end if
PushFeedItem(video, context) PushFeedItem(video, context)
return invalid return invalid
end function end function
@@ -1149,10 +1159,37 @@ namespace Innertube
"lines": renderedLines "lines": renderedLines
} }
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
playlist["authorId"] = authorId
end if
PushFeedItem(playlist, context) PushFeedItem(playlist, context)
return invalid return invalid
end function end function
function ParseTileRendererAuthorId(nodeData as object, context as object) as dynamic
' We're checking in the long press menu if there's a browseId that starts with "UC".
' This is usually the the id of the channel.
menuItems = ObjectUtils.Dig(nodeData, ["onLongPressCommand", "showMenuCommand", "menu", "menuRenderer", "items"])
if not IsArray(menuItems)
return invalid
end if
for each item in menuItems
if not IsAssociativeArray(item) or not item.DoesExist("menuNavigationItemRenderer")
continue for
end if
menuNavigationItemRenderer = item["menuNavigationItemRenderer"]
browseId = ObjectUtils.Dig(menuNavigationItemRenderer, ["navigationEndpoint", "browseEndpoint", "browseId"])
if not IsString(browseId) or not browseId.StartsWith("UC")
continue for
end if
return browseId
end for
return invalid
end function
function ParseGridRenderer(nodeData as object, context as object) as object function ParseGridRenderer(nodeData as object, context as object) as object
continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"]) continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
if IsString(continuation) if IsString(continuation)