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

[Bug] TypeError: str() takes at most 1 argument (2 given) #168

Closed
6 tasks done
awei78 opened this issue Nov 11, 2020 · 1 comment
Closed
6 tasks done

[Bug] TypeError: str() takes at most 1 argument (2 given) #168

awei78 opened this issue Nov 11, 2020 · 1 comment

Comments

@awei78
Copy link

awei78 commented Nov 11, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dlc version 2020.10.31
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

Connected to pydev debugger (build 192.7142.56)
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--proxy', u'http://127.0.0.1:1080/', u'-v', u'-i', u'-j', u'--flat-playlist', u'https://www.youtube.com/watch?v=nWb_X3ZJQjw&list=PLBHgMN3r4ZNwObXsF5soCCCh0bvBNpgN2']
[debug] Loading archive file None
[debug] Encodings: locale cp936, fs mbcs, out UTF-8, pref cp936
[debug] youtube-dlc version 2020.11.11-1
[debug] Python version 2.7.18 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: none
[debug] Proxy map: {u'http': u'http://127.0.0.1:1080/', u'https': u'http://127.0.0.1:1080/'}
ERROR: str() takes at most 1 argument (2 given)
Traceback (most recent call last):
  File "E:\GitHub\CRTubeGet\trunk\packages\youtube-dlc\youtube_dlc\YoutubeDL.py", line 846, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "E:\GitHub\CRTubeGet\trunk\packages\youtube-dlc\youtube_dlc\YoutubeDL.py", line 1007, in process_ie_result
    ie_entries, playliststart, playlistend))
  File "E:\GitHub\CRTubeGet\trunk\packages\youtube-dlc\youtube_dlc\extractor\youtube.py", line 377, in _entries
    }), encoding='utf-8'),
TypeError: str() takes at most 1 argument (2 given)

Description

In Python 2.7 environment, this code broken:
youtube.py, line 374

                        data=bytes(json.dumps({
                            'context': try_get(yt_conf, lambda x: x['INNERTUBE_CONTEXT']),
                            'continuation': continuation_token
                        }), encoding='utf-8'),

TypeError: str() takes at most 1 argument (2 given).
The str function in python 2.7 only take 1 argument.
Can be modified to:

                        data = str(json.dumps({
                            'context': try_get(yt_conf, lambda x: x['INNERTUBE_CONTEXT']),
                            'continuation': continuation_token
                        })).encode(encoding='UTF-8',errors='strict'),
@xeon927
Copy link

xeon927 commented Nov 11, 2020

I was having this issue too, I solved it by uninstalling and reinstalling using python3 (assuming that it was using python2.7 when it installed before, looks like you're also running 2.7 based on your debug info you posted).

Based on file paths, I'm guessing you're running Windows, so not entirely sure as to making sure that it's installed with python3, but for reference, Ubuntu/Debian instructions are as follows -

Uninstall:

python -m pip uninstall youtube-dlc

Reinstall:

sudo apt install python3-pip
python3 -m pip install git+https://github.com/blackjack4494/yt-dlc

Running:

python3 /home/xeon927/.local/youtube-dlc "insert-playlist-url-here"

It's working great for me after this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants