-
-
Notifications
You must be signed in to change notification settings - Fork 543
[YouTube] Improve lockup view model metadata extraction #1336
Copy link
Copy link
Open
Labels
YouTubeService, https://www.youtube.com/Service, https://www.youtube.com/code qualityImprovements to the codebase to improve the code qualityImprovements to the codebase to improve the code qualityenhancementNew feature or requestNew feature or requestgood first issueEasy/simple issues perfect for newcomers to get involved in the projectEasy/simple issues perfect for newcomers to get involved in the project
Metadata
Metadata
Assignees
Labels
YouTubeService, https://www.youtube.com/Service, https://www.youtube.com/code qualityImprovements to the codebase to improve the code qualityImprovements to the codebase to improve the code qualityenhancementNew feature or requestNew feature or requestgood first issueEasy/simple issues perfect for newcomers to get involved in the projectEasy/simple issues perfect for newcomers to get involved in the project
The metadata in the lockup view model is distributed across 2/3 rows and possibly there are multiple items per row. As of #1320 the
YouTubeStreamInfoItemLockupExtractoraccesses specific rows and columns by index, expecting to always find the same piece of data (uploader name, view count, upload date) in the same place.The following was originally posted by @Stypox in #1320 (comment)
Can we trust the indices to be stable? I guess we can't do much better anyway, so let's try like this for now. If it creates problems, we can always use other ways to detect the right metadata parts in the future, e.g.:
See here
[ { "metadataParts": [ { "text": { "content": "Justin Bieber", "styleRuns": [ { "startIndex": 13, "styleRunExtensions": { "styleRunColorMapExtension": { "colorMap": [ { "key": "USER_INTERFACE_THEME_LIGHT", "value": 4284506208 }, { "key": "USER_INTERFACE_THEME_DARK", "value": 4289374890 } ] } } } ], "attachmentRuns": [ { "startIndex": 13, "length": 0, "element": { "type": { "imageType": { "image": { "sources": [ { "clientResource": { "imageName": "AUDIO_BADGE" }, "width": 14, "height": 14 } ] } } }, "properties": { "layoutProperties": { "height": { "value": 14, "unit": "DIMENSION_UNIT_POINT" }, "width": { "value": 14, "unit": "DIMENSION_UNIT_POINT" }, "margin": { "left": { "value": 4, "unit": "DIMENSION_UNIT_POINT" } } } } }, "alignment": "ALIGNMENT_VERTICAL_CENTER" } ] } } ] }, { "metadataParts": [ { "text": { "content": "157M views" } }, { "text": { "content": "5 years ago" } } ] }, { "badges": [ { "badgeViewModel": { "badgeText": "Free with ads", "badgeStyle": "BADGE_COMMERCE", "trackingParams": "COcBENTEDBgBIhMIs6r8_ZS9jgMVOxYGAB1LCied" } }, { "badgeViewModel": { "badgeText": "T", "badgeStyle": "BADGE_DEFAULT", "trackingParams": "COcBENTEDBgBIhMIs6r8_ZS9jgMVOxYGAB1LCied" } } ] } ]