Skip to content

Commit

Permalink
Fixed parsed width/height of iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Jun 4, 2024
1 parent 4a96932 commit 8ac5fa6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ class HtmlLinearizer {
}

private fun ListBuilderScope<LinearElement>.parseIframeVideo(element: Element) {
val width = element.attr("width").toIntOrNull()
val height = element.attr("height").toIntOrNull()
getVideo(element.attr("abs:src").ifBlank { null })?.let { video ->
add(
LinearVideo(
Expand All @@ -639,8 +641,8 @@ class HtmlLinearizer {
uri = video.src,
link = video.link,
imageThumbnail = video.imageUrl,
widthPx = video.width,
heightPx = video.height,
widthPx = width ?: video.width,
heightPx = height ?: video.height,
mimeType = null,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ class HtmlLinearizerTest {
"https://www.youtube.com/embed/x_m02bUxfvE?feature=oembed",
"https://www.youtube.com/watch?v=x_m02bUxfvE",
"http://img.youtube.com/vi/x_m02bUxfvE/hqdefault.jpg",
480,
360,
1170,
658,
null,
),
),
Expand Down

0 comments on commit 8ac5fa6

Please sign in to comment.