mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	Use a wrapper around xml.etree.ElementTree.fromstring in python 2.x (#7178)
Attributes aren't unicode objects, so they couldn't be directly used in info_dict fields (for example '--write-description' doesn't work with bytes).
This commit is contained in:
		| @@ -5,12 +5,12 @@ import re | ||||
| import json | ||||
| import base64 | ||||
| import zlib | ||||
| import xml.etree.ElementTree | ||||
|  | ||||
| from hashlib import sha1 | ||||
| from math import pow, sqrt, floor | ||||
| from .common import InfoExtractor | ||||
| from ..compat import ( | ||||
|     compat_etree_fromstring, | ||||
|     compat_urllib_parse, | ||||
|     compat_urllib_parse_unquote, | ||||
|     compat_urllib_request, | ||||
| @@ -234,7 +234,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text | ||||
|         return output | ||||
|  | ||||
|     def _extract_subtitles(self, subtitle): | ||||
|         sub_root = xml.etree.ElementTree.fromstring(subtitle) | ||||
|         sub_root = compat_etree_fromstring(subtitle) | ||||
|         return [{ | ||||
|             'ext': 'srt', | ||||
|             'data': self._convert_subtitles_to_srt(sub_root), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jaime Marquínez Ferrándiz
					Jaime Marquínez Ferrándiz