How to use tubeup - 10 common examples

To help you get started, we’ve selected a few tubeup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_get_resource_basenames(self):
        tu = TubeUp(dir_path=os.path.join(current_path,
                                          'test_tubeup_rootdir'),
                    # HACK: A hack to make the test in Travis successful,
                    # We need to investigate more about this, it doesn't
                    # make sense that the verbose flag affect the
                    # youtubedl extract_info() process.
                    # See:
                    # https://travis-ci.org/bibanon/tubeup/builds/299091640
                    verbose=True)

        copy_testfiles_to_tubeup_rootdir_test()

        result = tu.get_resource_basenames(
            ['https://www.youtube.com/watch?v=6iRV8liah8A'])

        expected_result = {os.path.join(
            current_path, 'test_tubeup_rootdir', 'downloads',
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_archive_urls(self):
        tu = TubeUp(dir_path=os.path.join(current_path,
                                          'test_tubeup_rootdir'),
                    ia_config_path=get_testfile_path('ia_config_for_test.ini'),
                    # HACK: A hack to make the test in Travis successful,
                    # We need to investigate more about this, it doesn't
                    # make sense that the verbose flag affect the
                    # youtubedl extract_info() process.
                    # See:
                    # https://travis-ci.org/bibanon/tubeup/builds/299091640
                    verbose=True)

        videobasename = os.path.join(
            current_path, 'test_tubeup_rootdir', 'downloads',
            'Mountain_3_-_Video_Background_HD_1080p-6iRV8liah8A')

        copy_testfiles_to_tubeup_rootdir_test()
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_upload_ia(self):
        tu = TubeUp(dir_path=os.path.join(current_path,
                                          'test_tubeup_rootdir'),
                    # Use custom ia configuration file so we don't need
                    # to login with username and password.
                    ia_config_path=get_testfile_path('ia_config_for_test.ini'))

        videobasename = os.path.join(
            current_path, 'test_tubeup_rootdir', 'downloads',
            'Mountain_3_-_Video_Background_HD_1080p-6iRV8liah8A')

        copy_testfiles_to_tubeup_rootdir_test()

        with requests_mock.Mocker() as m:
            # Mock the request to s3.us.archive.org, so it will responds
            # a custom json. `internetarchive` library sends GET request to
            # that url to check that we don't violate the upload limit.
            m.get('https://s3.us.archive.org',
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_generate_ydl_options_with_verbose_mode(self):
        tu = TubeUp(verbose=True)
        result = tu.generate_ydl_options(
            mocked_ydl_progress_hook, ydl_username='testUsername',
            ydl_password='testPassword')

        expected_result = {
            'outtmpl': os.path.join(
                self.tu.dir_path['downloads'], '%(title)s-%(id)s.%(ext)s'),
            'restrictfilenames': True,
            'verbose': True,
            'quiet': False,
            'progress_with_newline': True,
            'forcetitle': True,
            'continuedl': True,
            'retries': 9001,
            'fragment_retries': 9001,
            'forcejson': True,
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_tubeup_attribute_logger_when_verbose_mode(self):
        tu = TubeUp(verbose=True)
        self.assertIsInstance(tu.logger, Logger)
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def setUp(self):
        self.tu = TubeUp()
        self.maxDiff = 999999999
github bibanon / tubeup / tests / test_utils.py View on Github external
def test_check_is_file_empty_when_file_is_not_empty(self):
        with open('testfilenotempty.txt', 'w') as not_empty_file:
            not_empty_file.write('just a text')

        self.assertFalse(check_is_file_empty('testfilenotempty.txt'))
        os.remove('testfilenotempty.txt')
github bibanon / tubeup / tests / test_utils.py View on Github external
def test_check_is_file_empty_when_file_doesnt_exist(self):
        with self.assertRaisesRegex(
                FileNotFoundError,
                r"^Path 'file_that_doesnt_exist.txt' doesn't exist$"):
            check_is_file_empty('file_that_doesnt_exist.txt')
github bibanon / tubeup / tests / test_utils.py View on Github external
def test_check_is_file_empty_when_file_is_empty(self):
        # Create a file for the test
        with open('testemptyfile.txt', 'w'):
            pass

        self.assertTrue(check_is_file_empty('testemptyfile.txt'))
        os.remove('testemptyfile.txt')
github bibanon / tubeup / tests / test_tubeup.py View on Github external
def test_create_archive_org_metadata_from_youtubedl_meta_no_date(self):
        with open(get_testfile_path(
                'Mountain_3_-_Video_Background_HD_1080p-6iRV8liah8A.'
                'info_no_date.json')
        ) as f:
            vid_meta = json.load(f)

        result = TubeUp.create_archive_org_metadata_from_youtubedl_meta(
            vid_meta
        )

        upload_date = time.strftime("%Y-%m-%d")
        upload_year = time.strftime("%Y")

        expected_result = {
            'mediatype': 'movies',
            'creator': 'Video Background',
            'collection': 'opensource_movies',
            'title': 'Mountain 3 - Video Background HD 1080p',
            'description': ('Mountain 3 - Video Background HD 1080p\n'
                            'If you use this video please put credits to my '
                            'channel in description:\nhttps://www.youtube.com'
                            '/channel/UCWpsozCMdAnfI16rZHQ9XDg\n© Don\'t '
                            'forget to SUBSCRIBE, LIKE, COMMENT and RATE. '