def test_netrc_present(self): for ie in gen_extractors(): if not hasattr(ie, '_login'): continue self.assertTrue( hasattr(ie, '_NETRC_MACHINE'), 'Extractor %s supports login, but is missing a _NETRC_MACHINE property' % ie.IE_NAME)
def test_no_duplicates(self): ies = gen_extractors() for tc in gettestcases(): url = tc['url'] for ie in ies: if type(ie).__name__ in ('GenericIE', tc['name'] + 'IE'): self.assertTrue(ie.suitable(url), '%s should match URL %r' % (type(ie).__name__, url)) else: self.assertFalse(ie.suitable(url), '%s should not match URL %r' % (type(ie).__name__, url))
def test_no_duplicates(self): ies = gen_extractors() for tc in get_testcases(): url = tc["url"] for ie in ies: if type(ie).__name__ in ("GenericIE", tc["name"] + "IE"): self.assertTrue(ie.suitable(url), "%s should match URL %r" % (type(ie).__name__, url)) else: self.assertFalse(ie.suitable(url), "%s should not match URL %r" % (type(ie).__name__, url))
def test_keywords(self): ies = gen_extractors() matching_ies = lambda url: [ie.IE_NAME for ie in ies if ie.suitable(url) and ie.IE_NAME != 'generic'] self.assertEqual(matching_ies(':ytsubs'), ['youtube:subscriptions']) self.assertEqual(matching_ies(':ytsubscriptions'), ['youtube:subscriptions']) self.assertEqual(matching_ies(':thedailyshow'), ['ComedyCentral']) self.assertEqual(matching_ies(':tds'), ['ComedyCentral']) self.assertEqual(matching_ies(':colbertreport'), ['ComedyCentral']) self.assertEqual(matching_ies(':cr'), ['ComedyCentral'])
def supported_sites(request): """ Returns the list of support sites. """ sites = [x.IE_NAME for x in extractor.gen_extractors()] sites.sort() data = { "sites": sites, } return render(request, 'videodl/supported_sites.html', data)
def generateBlacklist(regexs): """ Generate a blacklist of extractors based on IE_NAME. regexs is a list or tuple of regular expressions. Extractors that match any of the regular expressions are added. """ import re from youtube_dl.extractor import gen_extractors for ie in gen_extractors(): for r in regexs: if re.search(r, ie.IE_NAME): YoutubeDLWrapper._BLACKLIST.append(ie.IE_NAME)
def test_no_duplicates(self): ies = gen_extractors() for tc in gettestcases(include_onlymatching=True): url = tc['url'] for ie in ies: if type(ie).__name__ in ('GenericIE', tc['name'] + 'IE'): self.assertTrue( ie.suitable(url), '%s should match URL %r' % (type(ie).__name__, url)) else: self.assertFalse( ie.suitable(url), '%s should not match URL %r' % (type(ie).__name__, url))
def setUp(self): self.ies = gen_extractors()
def __get_gen_extractors(): from youtube_dl import extractor as __extractor return __extractor.gen_extractors()
def default_extractors(): for ie in gen_extractors(): key = ie.ie_key() if not(key == "Generic" or key.endswith("Channel") or key.endswith("Playlist") or key.endswith("User")) and "crunchyroll" not in key.lower(): yield ie
#!/usr/bin/env python3 import click import sh import os import re import glob import subprocess import youtube_dl from youtube_dl.compat import compat_expanduser from youtube_dl.extractor import gen_extractors from kcl.printops import ceprint extractors = gen_extractors() QUEUE_CMD = ['/home/cfg/redis/rpush', 'mpv'] downloaded_video_list = [] VIDEO_CMD = ['/usr/bin/xterm', '-e', '/usr/bin/mpv', '--cache-pause', '--hwdec=vdpau', '--cache-initial=75000', '--cache-default=275000', '--pause'] def is_non_zero_file(fpath): if os.path.isfile(fpath) and os.path.getsize(fpath) > 0: return True