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

ytsearch* does not work with --cookies #11924

Closed
Tatsh opened this issue Jan 31, 2017 · 5 comments
Closed

ytsearch* does not work with --cookies #11924

Tatsh opened this issue Jan 31, 2017 · 5 comments
Labels
bug

Comments

@Tatsh
Copy link
Contributor

@Tatsh Tatsh commented Jan 31, 2017

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.01.31. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.01.31

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)

$ ./bin/youtube-dl -i --no-progress --continue --cookies ~/.ytch-cookies.txt --dateafter $(date --date='2 days ago' +%Y%m%d) 'ytsearchall:space' --verbose
[debug] System config: []
[debug] User config: [u'--restrict-filenames', u'--no-overwrites', u'--embed-subs', u'--add-metadata', u'--netrc', u'--format', u'bestvideo[ext!=webm]+bestaudio[ext!=webm]/best[ext!=webm]/best', u'--merge-output-format', u'mp4', u'--prefer-ffmpeg', u'--output', u'%(title)s___src=%(extractor)s___id=%(id)s.%(ext)s', u'--embed-subs', u'--embed-thumbnail', u'--xattrs', u'--force-ipv4']
[debug] Custom config: []
[debug] Command-line args: [u'-i', u'--no-progress', u'--continue', u'--cookies', u'/home/tatsh/.ytch-cookies.txt', u'--dateafter', u'20170129', u'ytsearchall:space', u'--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.01.28
[debug] Python version 2.7.12 - Linux-4.9.6-gentoo-limelight-x86_64-Intel-R-_Core-TM-_i7-5930K_CPU_@_3.50GHz-with-gentoo-2.3
[debug] exe versions: ffmpeg 3.2.2, ffprobe 3.2.2, rtmpdump 2.4
[debug] Proxy map: {}
WARNING: parsing .netrc: No authenticators for youtube (None, line None)
[youtube:search] query "space": Downloading page 1
ERROR: An extractor error has occurred. (caused by KeyError(1,)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/youtube_dl/extractor/common.py", line 359, in extract
    return self._real_extract(url)
  File "/usr/lib64/python2.7/site-packages/youtube_dl/extractor/common.py", line 2188, in _real_extract
    return self._get_n_results(query, self._MAX_RESULTS)
  File "/usr/lib64/python2.7/site-packages/youtube_dl/extractor/youtube.py", line 2356, in _get_n_results
    html_content = data[1]['body']['content']
KeyError: 1
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 694, in extract_info
    ie_result = ie.extract(url)
  File "/usr/lib64/python2.7/site-packages/youtube_dl/extractor/common.py", line 365, in extract
    raise ExtractorError('An extractor error has occurred.', cause=e)
ExtractorError: An extractor error has occurred. (caused by KeyError(1,)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

When I remove the --cookies argument, ytsearch and similar queries work. But I generally want to use cookies because of 2-factor authentication.

@Tatsh
Copy link
Contributor Author

@Tatsh Tatsh commented Jan 31, 2017

By the way, 2017.01.31 branch gives [debug] youtube-dl version 2017.01.28 still.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 1, 2017

By the way, 2017.01.31 branch gives [debug] youtube-dl version 2017.01.28 still.

$ youtube-dl -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.01.31
[debug] Git HEAD: 2b2d5d319
[debug] Python version 3.6.0 - Linux-4.9.5-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.2.2, ffprobe 3.2.2
[debug] Proxy map: {}
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

Most likely there are multiple versions on your machine

@Tatsh
Copy link
Contributor Author

@Tatsh Tatsh commented Feb 1, 2017

Yes I fixed that and ensured I got the right version (from repository not system). Same error with 2017.01.31.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 1, 2017

The API used in youtube-dl (https://www.youtube.com/results?search_query=foobar&page=1&spf=navigate) does not work in browsers, either. I guess disabling cookies for this specific request will solve the problem.

@yan12125 yan12125 added the bug label Feb 1, 2017
@yan12125 yan12125 closed this in a22b2fd Feb 2, 2017
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 2, 2017

OK I've implemented the new search API in youtube-dl. ytsearch* will work with cookies in the next version.

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.