Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

下载优酷视频时出现ValueError: Sign not allowed in string format specifier 错误 #52

Open
Z4HD opened this issue Feb 9, 2018 · 3 comments
Labels
common help wanted Extra attention is needed

Comments

@Z4HD
Copy link

Z4HD commented Feb 9, 2018

系统环境: Android 7.1.2 Termux Python3.6.4 lulu 0.3.2

下载一般睿站视频时亦有可能发生这个问题。


输出全文如下

$ lulu -V
lulu: version 0.3.2, a tiny downloader that scrapes the web.
$ lulu -d --format=mp4hd http://v.youku.com/v_show/id_XNjA4MzA1MjY4
[DEBUG] get_content: https://ups.youku.com/ups/get.json?vid=XNjA4MzA1MjY4&ccode=0507&client_ip=192.168.1.1&utid=VxAEE1fOSgYCAa%2BjQ4XPTyNf&client_ts=1518150235
lulu: version 0.3.2, a tiny downloader that scrapes the web.
lulu: Namespace(URL=['http://v.youku.com/v_show/id_XNjA4MzA1MjY4';], cookies=None, debug=True, extractor_proxy=None, force=False, format='mp4hd', help=False, http_proxy=None, info=False, input_file=None, itag=None, json=False, no_caption=False, no_merge=False, no_proxy=False, output_dir='.', output_filename=None, password=None, player=None, playlist=False, socks_proxy=None, stream=None, timeout=600, url=False, version=False)
site: 优酷 (Youku)
title: 龙兄虎弟
stream:
- format: mp4hd
container: mp4
video-profile: 高清
size: 385.39999999999998 MiB (404139132 bytes)
m3u8_url: http://pl.cp12.wasu.tv/playlist/m3u8?vid=XNjA4MzA1MjY4&type=mp4&ups_client_netip=afa34385&utid=VxAEE1fOSgYCAa%2BjQ4XPTyNf&ccode=0507&psid=9b4d4e221d79a349d536e48a9b6f0c98&duration=5869&expire=18000&ups_ts=1518150234&onOff=0&encr=1&ups_key=3392a85de76518cbcf4922cf2c5a0c75
# download-with: lulu --format=mp4hd [URL]

audio-languages:
- lang: 国语
download-url: http://v.youku.com/v_show/id_XNjA4MzA1MjY4

- lang: 粤语
download-url: http://v.youku.com/v_show/id_XNzMyMDUwNDgw

Downloading 龙兄虎弟.mp4 ...
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/lulu", line 11, in <module>
sys.exit(main())
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/__main__.py", line 92, in main
main(**kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1485, in main
script_main(any_download, any_download_playlist, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1375, in script_main
**extra
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1121, in download_main
download(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1476, in any_download
m.download(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractors/youku.py", line 349, in youku_download_by_url
Youku().download_by_url(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractor.py", line 86, in download_by_url
self.download(**kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractor.py", line 302, in download
av=stream_id in self.dash_streams
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 802, in download_urls
bar.update()
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 651, in update
self.current_piece, self.total_pieces, self.speed
ValueError: Sign not allowed in string format specifier
@iawia002 iawia002 added the common label Feb 9, 2018
@iawia002
Copy link
Owner

iawia002 commented Feb 9, 2018

我复现不了这个错,看样子应该是 self.current_piece, self.total_pieces, self.speed 中哪个的值出现了异常。你稳定复现吗?

@Z4HD
Copy link
Author

Z4HD commented Feb 10, 2018

经测试,在Win10上一切正常,无法复现。

但在Termux中又出现了另一种错误:

╭─u0_a146@localhost ~
╰─➤ lulu -V
lulu: version 0.3.2, a tiny downloader that scrapes the web.
╭─u0_a146@localhost ~
╰─➤ lulu -d --format=mp4hd http://v.youku.com/v_show/id_XNjA4MzA1MjY4
lulu: version 0.3.2, a tiny downloader that scrapes the web.
lulu: Namespace(URL=['http://v.youku.com/v_show/id_XNjA4MzA1MjY4';], cookies=None, debug=True, extractor_proxy=None, force=False, format='mp4hd', help=False, http_proxy=None, info=False, input_file=None, itag=None, json=False, no_caption=False, no_merge=False, no_proxy=False, output_dir='.', output_filename=None, password=None, player=None, playlist=False, socks_proxy=None, stream=None, timeout=600, url=False, version=False)
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/data/data/com.termux/files/usr/lib/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/data/data/com.termux/files/usr/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/data/data/com.termux/files/usr/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/lulu", line 11, in <module>
sys.exit(main())
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/__main__.py", line 92, in main
main(**kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1485, in main
script_main(any_download, any_download_playlist, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1375, in script_main
**extra
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1121, in download_main
download(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/common.py", line 1476, in any_download
m.download(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractors/youku.py", line 349, in youku_download_by_url
Youku().download_by_url(url, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractor.py", line 63, in download_by_url
self.prepare(**kwargs)
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractors/youku.py", line 177, in prepare
self.utid = fetch_cna()
File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/lulu/extractors/youku.py", line 30, in fetch_cna
req = urllib.request.urlopen(url)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/data/data/com.termux/files/usr/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

运行环境

Python3.6.4

╭─u0_a146@localhost ~
╰─➤  neofetch
     ╲ ▁▂▂▂▁ ╱        u0_a146@localhost
     ▄███████▄        -----------------
    ▄██ ███ ██▄       OS: Android 5.1 aarch64
   ▄███████████▄      Host: htc HTC One M9
▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄   Kernel: 3.10.49-perf-g27e37
██ █████████████ ██   Uptime: 1 day, 8 hours, 18s
██ █████████████ ██   Packages: 118
██ █████████████ ██   Shell: login zsh 5.4.2
██ █████████████ ██   Terminal: com.termux
   █████████████      CPU: Qualcomm MSM8994 (8) z
    ███████████       Memory: 1731MiB / 2767MiB
     ██     ██
     ██     ██

有可能是与运行平台有关的问题?

@iawia002 iawia002 added the help wanted Extra attention is needed label Mar 6, 2018
@lkkljk
Copy link

lkkljk commented Apr 3, 2019

请问楼主后来解决了吗?是怎么解决的?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
common help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants