Skip to content

Commit 68ae2e3

Browse files
committed
update duration container name for premiere - Plus handle old container name also - fixes OsaSoft#257
1 parent 85becbc commit 68ae2e3

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

tests/fixtures/subscription-feed.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- YouTube Subscription Feed Mock Structure -->
1+
<!-- YouTube Subscription Feed Mock Structure - pre 2026-04 -->
22
<div id="page-manager">
33
<ytd-browse page-subtype="subscriptions">
44
<div id="primary">
@@ -27,7 +27,7 @@
2727
<a id="video-title" href="/watch?v=video1234567">
2828
<span>Video 1</span>
2929
</a>
30-
<div class="ytBadgeShapeText">5:30</div>
30+
<div class="yt-badge-shape__text">5:30</div>
3131
</div>
3232
</ytd-rich-item-renderer>
3333

@@ -37,7 +37,7 @@
3737
<a id="video-title" href="/watch?v=video2345678">
3838
<span>Video 2</span>
3939
</a>
40-
<div class="ytBadgeShapeText">10:00</div>
40+
<div class="yt-badge-shape__text">10:00</div>
4141
</div>
4242
</ytd-rich-item-renderer>
4343

@@ -66,7 +66,7 @@
6666
<span>Members Only Video</span>
6767
</a>
6868
<div class="yt-badge-shape--membership">Members only</div>
69-
<div class="ytBadgeShapeText">20:00</div>
69+
<div class="yt-badge-shape__text">20:00</div>
7070
</div>
7171
</ytd-rich-item-renderer>
7272

videos/Video.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function getVideoId(item) {
4343
}
4444

4545
function getVideoDuration(item) {
46+
4647
// Try old layout selector
4748
let durationDiv = item.containingDiv.querySelector(".ytBadgeShapeText");
4849
if ((durationDiv != null) && (durationDiv.textContent.includes(":"))) {
@@ -61,6 +62,12 @@ function getVideoDuration(item) {
6162
}
6263
}
6364

65+
// Try older layout selector pre 2026-04
66+
let durationDiv = item.containingDiv.querySelector(".yt-badge-shape__text");
67+
if ((durationDiv != null) && (durationDiv.textContent.includes(":"))) {
68+
return durationDiv.textContent;
69+
}
70+
6471
return null;
6572
}
6673

0 commit comments

Comments
 (0)