Skip to content

Commit

Permalink
[generic] Add support for xfileshare embeds (closes #15879)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Mar 17, 2018
1 parent d123960 commit 178ee88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions youtube_dl/extractor/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
from .springboardplatform import SpringboardPlatformIE
from .yapfiles import YapFilesIE
from .vice import ViceIE
from .xfileshare import XFileShareIE


class GenericIE(InfoExtractor):
Expand Down Expand Up @@ -2971,6 +2972,11 @@ def _real_extract(self, url):
return self.playlist_from_matches(
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):
merged = {}
for k, v in dict1.items():
Expand Down
9 changes: 9 additions & 0 deletions youtube_dl/extractor/xfileshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ class XFileShareIE(InfoExtractor):
'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):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
Expand Down

1 comment on commit 178ee88

@kayb94
Copy link
Contributor

@kayb94 kayb94 commented on 178ee88 Mar 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit number 16000!!!11!!! xD 😛

Please sign in to comment.