- quality_attributes = quality.findall("CustomAttributes/Attribute")
- custom_attributes = ""
- for i in quality_attributes:
- custom_attributes += "%s=%s," % (i.attrib["Name"], i.attrib["Value"])
- custom_attributes = custom_attributes.rstrip(',')
-
- # Assume URLs are in this form:
- # Url="QualityLevels({bitrate})/Fragments(video={start time})"
- # or
- # Url="QualityLevels({bitrate},{CustomAttributes})/Fragments(video={start time})"
- url = stream.attrib["Url"]
-
- chunks_quality = url.split('/')[0].replace("{bitrate}", bitrate)
- chunks_quality = chunks_quality.replace("{CustomAttributes}", custom_attributes)