Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BritishCouncil] Add new extractor #25424

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions youtube_dl/extractor/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
from .zype import ZypeIE
from .odnoklassniki import OdnoklassnikiIE
from .kinja import KinjaEmbedIE
from .viddler import ViddlerIE


class GenericIE(InfoExtractor):
Expand Down Expand Up @@ -1098,6 +1099,20 @@ class GenericIE(InfoExtractor):
},
'add_ie': ['Viddler'],
},
{
'url': 'https://learnenglish.britishcouncil.org/episode-01-they-meet',
'md5': '796e9c4fa07017e3da79d5e99ef36fe8',
'info_dict': {
'id': '34d5e84c',
'ext': 'mp4',
'title': 'StartingOut.s01e01',
'upload_date': '20160927',
'uploader': 'BCLearnenglish',
'timestamp': 1474975664,
'view_count': int,
'comment_count': int,
},
},
# Libsyn embed
{
'url': 'http://thedailyshow.cc.com/podcast/episodetwelve',
Expand Down Expand Up @@ -2580,6 +2595,12 @@ def _real_extract(self, url):
if mobj is not None:
return self.url_result(mobj.group('url'))

mobj = re.search(
r'<div[^>]+class=(["\'])viddler-auto-embed\1[^>]+data-video-id=([\'"])(?P<id>[^\'"]+)',
webpage)
if mobj is not None:
return ViddlerIE._build_url_result(mobj.group('id'))

Copy link
Collaborator

Choose a reason for hiding this comment

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

Move embed extraction code to ViddlerIE._extract_urls.

# Look for NYTimes player
mobj = re.search(
r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//graphics8\.nytimes\.com/bcvideo/[^/]+/iframe/embed\.html.+?)\1>',
Expand Down
9 changes: 9 additions & 0 deletions youtube_dl/extractor/viddler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ class ViddlerIE(InfoExtractor):
},
}]

@staticmethod
def _url_for_id(id):
return 'http://www.viddler.com/v/%s' % id

@classmethod
def _build_url_result(cls, id):
return cls.url_result(cls._url_for_id(id),
ie=cls.ie_key())
Comment on lines +77 to +84
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inline.


def _real_extract(self, url):
video_id, secret = re.match(self._VALID_URL, url).groups()

Expand Down