Merge 9209b21769052991f5507db836569b4fd4f1418d into 9eda6e5bc433638ee251e06d05daff3fdd12ca86

This commit is contained in:
shiny-comic 2026-04-25 17:50:43 -04:00 committed by GitHub
commit e39fac07db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,8 +21,6 @@ private def copy_string(str : String::Builder, iter : Iterator, count : Int) : I
str << cp.chr str << cp.chr
end end
# A codepoint from the SMP counts twice
copied += 1 if cp > 0xFFFF
copied += 1 copied += 1
end end
@ -44,10 +42,6 @@ def parse_description(desc, video_id : String) : String?
end end
end end
# Not everything is stored in UTF-8 on youtube's side. The SMP codepoints
# (0x10000 and above) are encoded as UTF-16 surrogate pairs, which are
# automatically decoded by the JSON parser. It means that we need to count
# copied byte in a special manner, preventing the use of regular string copy.
iter = content.each_codepoint iter = content.each_codepoint
index = 0 index = 0