Fix extraction of YouTube chapters (#531)

YouTube changed the name of the chapters in the JSON from engagement-panel-macro-markers to engagement-panel-macro-markers-description-chapters, so extracting chapters doesn't work.
This commit is contained in:
TiA4f8R 2021-02-03 22:07:34 +01:00 committed by GitHub
parent bfa639950e
commit 1414a6f178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1079,8 +1079,10 @@ public class YoutubeStreamExtractor extends StreamExtractor {
// Search for correct panel containing the data // Search for correct panel containing the data
for (int i = 0; i < panels.size(); i++) { for (int i = 0; i < panels.size(); i++) {
if (panels.getObject(i).getObject("engagementPanelSectionListRenderer") final String panelIdentifier = panels.getObject(i).getObject("engagementPanelSectionListRenderer")
.getString("panelIdentifier").equals("engagement-panel-macro-markers")) { .getString("panelIdentifier");
if (panelIdentifier.equals("engagement-panel-macro-markers-description-chapters")
|| panelIdentifier.equals("engagement-panel-macro-markers")) {
segmentsArray = panels.getObject(i).getObject("engagementPanelSectionListRenderer") segmentsArray = panels.getObject(i).getObject("engagementPanelSectionListRenderer")
.getObject("content").getObject("macroMarkersListRenderer").getArray("contents"); .getObject("content").getObject("macroMarkersListRenderer").getArray("contents");
break; break;

View File

@ -259,7 +259,6 @@ public class YoutubeStreamExtractorDefaultTest {
@Override public int expectedStreamSegmentsCount() { return 7; } @Override public int expectedStreamSegmentsCount() { return 7; }
@Test @Test
@Ignore("TODO fix")
public void testStreamSegment() throws Exception { public void testStreamSegment() throws Exception {
final StreamSegment segment = extractor.getStreamSegments().get(1); final StreamSegment segment = extractor.getStreamSegments().get(1);
assertEquals(164, segment.getStartTimeSeconds()); assertEquals(164, segment.getStartTimeSeconds());