mirror of
				https://gitlab.com/ytdl-org/youtube-dl.git
				synced 2025-11-04 01:57:08 -05:00 
			
		
		
		
	[generic] Add support for xfileshare embeds (closes #15879)
This commit is contained in:
		@@ -104,6 +104,7 @@ from .mediasite import MediasiteIE
 | 
				
			|||||||
from .springboardplatform import SpringboardPlatformIE
 | 
					from .springboardplatform import SpringboardPlatformIE
 | 
				
			||||||
from .yapfiles import YapFilesIE
 | 
					from .yapfiles import YapFilesIE
 | 
				
			||||||
from .vice import ViceIE
 | 
					from .vice import ViceIE
 | 
				
			||||||
 | 
					from .xfileshare import XFileShareIE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GenericIE(InfoExtractor):
 | 
					class GenericIE(InfoExtractor):
 | 
				
			||||||
@@ -2971,6 +2972,11 @@ class GenericIE(InfoExtractor):
 | 
				
			|||||||
            return self.playlist_from_matches(
 | 
					            return self.playlist_from_matches(
 | 
				
			||||||
                vice_urls, video_id, video_title, ie=ViceIE.ie_key())
 | 
					                vice_urls, video_id, video_title, ie=ViceIE.ie_key())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        xfileshare_urls = XFileShareIE._extract_urls(webpage)
 | 
				
			||||||
 | 
					        if xfileshare_urls:
 | 
				
			||||||
 | 
					            return self.playlist_from_matches(
 | 
				
			||||||
 | 
					                xfileshare_urls, video_id, video_title, ie=XFileShareIE.ie_key())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def merge_dicts(dict1, dict2):
 | 
					        def merge_dicts(dict1, dict2):
 | 
				
			||||||
            merged = {}
 | 
					            merged = {}
 | 
				
			||||||
            for k, v in dict1.items():
 | 
					            for k, v in dict1.items():
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,6 +118,15 @@ class XFileShareIE(InfoExtractor):
 | 
				
			|||||||
        'only_matching': True
 | 
					        'only_matching': True
 | 
				
			||||||
    }]
 | 
					    }]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @staticmethod
 | 
				
			||||||
 | 
					    def _extract_urls(webpage):
 | 
				
			||||||
 | 
					        return [
 | 
				
			||||||
 | 
					            mobj.group('url')
 | 
				
			||||||
 | 
					            for mobj in re.finditer(
 | 
				
			||||||
 | 
					                r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:%s)/embed-[0-9a-zA-Z]+.*?)\1'
 | 
				
			||||||
 | 
					                % '|'.join(site for site in list(zip(*XFileShareIE._SITES))[0]),
 | 
				
			||||||
 | 
					                webpage)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _real_extract(self, url):
 | 
					    def _real_extract(self, url):
 | 
				
			||||||
        mobj = re.match(self._VALID_URL, url)
 | 
					        mobj = re.match(self._VALID_URL, url)
 | 
				
			||||||
        video_id = mobj.group('id')
 | 
					        video_id = mobj.group('id')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user