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

Include site credential during development #24632

Closed
nixklai opened this issue Apr 5, 2020 · 1 comment
Closed

Include site credential during development #24632

nixklai opened this issue Apr 5, 2020 · 1 comment
Labels

Comments

@nixklai
Copy link

@nixklai nixklai commented Apr 5, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

I am trying to implement an extractor for Microsoft Stream, which requires users to log in to access any video. Is it possible to pass the username-password pair and/or the .netrc file to the extractor during development? I have tried the following:

  1. Defining a .netrc file without the --netrc argument
  2. Defining a _netrc file without the --netrc argument
  3. Defining a .netrc file with the --netrc argument
  4. Defining a _netrc file with the --netrc argument
  5. Defining the credential with the --username and --password arguments

A workaround I can think of it to hard-code a testing credential in NewSiteIE._get_login_info() during development and remove it before pushing it GitHub. Am I missing something in the documentation?

I am developing the extractor on my Windows 10 laptop running Python 3.7.6, based on commit 049c048

Many thanks!

Output of defining .netrc or _netrc file without netrc argument

PS D:\Users\user\Code\youtube-dl> python test/test_download.py TestDownload.test_MicrosoftStream   
[microsoftstream] c883c6a5-9895-4900-9a35-62f4b5d506c9: Downloading webpage
ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.
Traceback (most recent call last):
  File "D:\Users\user\Code\youtube-dl\youtube_dl\YoutubeDL.py", line 797, in extract_info
    ie_result = ie.extract(url)
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\microsoftstream.py", line 135, in _real_extract
    return self.raise_login_required()
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\common.py", line 936, in raise_login_required
    expected=True)
youtube_dl.utils.ExtractorError: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

E
======================================================================
ERROR: test_MicrosoftStream (__main__.TestDownload):
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Users\user\Code\youtube-dl\youtube_dl\YoutubeDL.py", line 797, in extract_info
    ie_result = ie.extract(url)
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\microsoftstream.py", line 135, in _real_extract
    return self.raise_login_required()
  File "D:\Users\user\Code\youtube-dl\youtube_dl\extractor\common.py", line 936, in raise_login_required
    expected=True)
youtube_dl.utils.ExtractorError: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test/test_download.py", line 159, in test_template
    force_generic_extractor=params.get('force_generic_extractor', False))
  File "D:\Users\user\Code\youtube-dl\youtube_dl\YoutubeDL.py", line 820, in extract_info
    self.report_error(compat_str(e), e.format_traceback())
  File "D:\Users\user\Code\youtube-dl\youtube_dl\YoutubeDL.py", line 625, in report_error
    self.trouble(error_message, tb)
  File "D:\Users\user\Code\youtube-dl\youtube_dl\YoutubeDL.py", line 595, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

----------------------------------------------------------------------
Ran 1 test in 1.163s

FAILED (errors=1)

Defining a _netrc or .netrc file with the --netrc argument

PS D:\Users\user\Code\youtube-dl> python test/test_download.py --netrc TestDownload.test_MicrosoftStream
usage: test_download.py [-h] [-v] [-q] [--locals] [-f] [-c] [-b]
                        [-k TESTNAMEPATTERNS]
                        [tests [tests ...]]
test_download.py: error: unrecognized arguments: --netrc

Defining the username-password pair with the --username and --password arguments

PS D:\Users\user\Code\youtube-dl> python test/test_download.py --username [username] --password [password] TestDownload.test_MicrosoftStream
usage: test_download.py [-h] [-v] [-q] [--locals] [-f] [-c] [-b]
                        [-k TESTNAMEPATTERNS]
                        [tests [tests ...]]
test_download.py: error: unrecognized arguments: --username --password [password] TestDownload.test_MicrosoftStream
@nixklai nixklai added the question label Apr 5, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 5, 2020

username: Username for authentication purposes.
password: Password for authentication purposes.

in test's params.

@dstftw dstftw closed this Apr 5, 2020
@nixklai nixklai mentioned this issue Apr 6, 2020
5 of 9 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.