mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-03 21:27:07 -05:00 
			
		
		
		
	Use _download_xml in more extractors
				
					
				
			This commit is contained in:
		@@ -1,8 +1,10 @@
 | 
			
		||||
import re
 | 
			
		||||
import xml.etree.ElementTree
 | 
			
		||||
import operator
 | 
			
		||||
 | 
			
		||||
from .common import InfoExtractor
 | 
			
		||||
from ..utils import (
 | 
			
		||||
    fix_xml_all_ampersand,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MetacriticIE(InfoExtractor):
 | 
			
		||||
@@ -23,9 +25,8 @@ class MetacriticIE(InfoExtractor):
 | 
			
		||||
        video_id = mobj.group('id')
 | 
			
		||||
        webpage = self._download_webpage(url, video_id)
 | 
			
		||||
        # The xml is not well formatted, there are raw '&'
 | 
			
		||||
        info_xml = self._download_webpage('http://www.metacritic.com/video_data?video=' + video_id,
 | 
			
		||||
            video_id, u'Downloading info xml').replace('&', '&')
 | 
			
		||||
        info = xml.etree.ElementTree.fromstring(info_xml.encode('utf-8'))
 | 
			
		||||
        info = self._download_xml('http://www.metacritic.com/video_data?video=' + video_id,
 | 
			
		||||
            video_id, u'Downloading info xml', transform_source=fix_xml_all_ampersand)
 | 
			
		||||
 | 
			
		||||
        clip = next(c for c in info.findall('playList/clip') if c.find('id').text == video_id)
 | 
			
		||||
        formats = []
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user