Plugin cleanup and tweaks
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
@@ -40,8 +38,7 @@ class TeachableBaseIE(InfoExtractor):
|
||||
if self._logged_in:
|
||||
return
|
||||
|
||||
username, password = self._get_login_info(
|
||||
netrc_machine=self._SITES.get(site, site))
|
||||
username, password = self._get_login_info(netrc_machine=self._SITES.get(site, site))
|
||||
if username is None:
|
||||
return
|
||||
|
||||
@@ -143,12 +140,12 @@ class TeachableIE(TeachableBaseIE):
|
||||
r'<link[^>]+href=["\']https?://(?:process\.fs|assets)\.teachablecdn\.com',
|
||||
webpage)
|
||||
|
||||
@staticmethod
|
||||
def _extract_url(webpage, source_url):
|
||||
if not TeachableIE._is_teachable(webpage):
|
||||
return
|
||||
if re.match(r'https?://[^/]+/(?:courses|p)', source_url):
|
||||
return '%s%s' % (TeachableBaseIE._URL_PREFIX, source_url)
|
||||
@classmethod
|
||||
def _extract_embed_urls(cls, url, webpage):
|
||||
if cls._is_teachable(webpage):
|
||||
if re.match(r'https?://[^/]+/(?:courses|p)', url):
|
||||
yield f'{cls._URL_PREFIX}{url}'
|
||||
raise cls.StopExtraction()
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = self._match_valid_url(url)
|
||||
@@ -163,7 +160,7 @@ class TeachableIE(TeachableBaseIE):
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
wistia_urls = WistiaIE._extract_urls(webpage)
|
||||
wistia_urls = WistiaIE._extract_embed_urls(url, webpage)
|
||||
if not wistia_urls:
|
||||
if any(re.search(p, webpage) for p in (
|
||||
r'class=["\']lecture-contents-locked',
|
||||
|
Reference in New Issue
Block a user