def fetch(url, action): backends = [BackendFactory(BackendFactory.ADOBEHDSPHP)] basic_filters = StreamFilters() io = IOContext(destdir='/tmp/') with Capturing() as output: res = download(url, action, io, stream_filters=basic_filters, backends=backends, postprocess_command=None) assert res == RD_SUCCESS return output
def fetch(url, action, filters, meta_language=None): io = IOContext(destdir='/tmp/', metadata_language=meta_language) httpclient = HttpClient() title_formatter = TitleFormatter() with Capturing() as output: res = execute_action(url, action, io, httpclient, title_formatter, stream_filters = filters) assert res == RD_SUCCESS return output
def fetch(url, action, filters): # Initialize rtmpdump_binary to avoid a file system lookup in tests io = IOContext(destdir='/tmp/', rtmpdump_binary='rtmpdump') httpclient = HttpClient() title_formatter = TitleFormatter() with Capturing() as output: res = download(url, action, io, httpclient, title_formatter, stream_filters=filters, postprocess_command=None) assert res == RD_SUCCESS return output
def simple(): return DownloaderParametersFixture(io=IOContext(destdir='/tmp/'), filters=StreamFilters(), downloader=YleDlDownloader( MockGeoLocation()))
from yledl import IOContext, RD_SUCCESS from yledl.backends import HLSBackend, WgetBackend tv1_url = 'https://yletv-lh.akamaihd.net/i/yletv1hls_1@103188/master.m3u8' io = IOContext(destdir='/tmp/') class MockHLSBackend(HLSBackend): def __init__(self, url, long_probe=False, program_id=None, is_live=False): super().__init__(url, long_probe, program_id, is_live) self.executed_commands = None def external_downloader(self, commands, env=None): self.executed_commands = commands return RD_SUCCESS def full_stream_already_downloaded(self, filename, clip, io): return False class MockWgetBackend(WgetBackend): def __init__(self, url, file_extension): super().__init__(url, file_extension) self.executed_commands = None def external_downloader(self, commands, env=None): self.executed_commands = commands return RD_SUCCESS
def simple(): return DownloaderParametersFixture( io=IOContext(destdir='/tmp/', rtmpdump_binary='rtmpdump'), filters=StreamFilters(), downloader=YleDlDownloader(MockSubtitleDownloader(), MockGeoLocation()))