Skip DASH streams segmented by URL

This commit is contained in:
Omar Roth 2020-07-04 14:17:46 -04:00
parent 8c65b8c16f
commit 8ed1c77e47
No known key found for this signature in database
GPG key ID: B8254FB7EC3D37F2

View file

@ -583,6 +583,9 @@ struct Video
fmt["url"] = JSON::Any.new("#{fmt["url"]}&host=#{URI.parse(fmt["url"].as_s).host}") fmt["url"] = JSON::Any.new("#{fmt["url"]}&host=#{URI.parse(fmt["url"].as_s).host}")
fmt["url"] = JSON::Any.new("#{fmt["url"]}&region=#{self.info["region"]}") if self.info["region"]? fmt["url"] = JSON::Any.new("#{fmt["url"]}&region=#{self.info["region"]}") if self.info["region"]?
end end
# See https://github.com/TeamNewPipe/NewPipe/issues/2415
# Some streams are segmented by URL `sq/` rather than index, for now we just filter them out
fmt_stream.reject! { |f| !f["indexRange"]? }
fmt_stream.sort_by! { |f| f["width"]?.try &.as_i || 0 } fmt_stream.sort_by! { |f| f["width"]?.try &.as_i || 0 }
@adaptive_fmts = fmt_stream @adaptive_fmts = fmt_stream
return @adaptive_fmts.as(Array(Hash(String, JSON::Any))) return @adaptive_fmts.as(Array(Hash(String, JSON::Any)))