zhangbo / pyM3u8

Download m3u8 segments asynchronously, still work on decrypt probolem
2 stars 1 forks source link

[Errno -2] Name or service not known #1

Open patrickwoolf opened 3 years ago

patrickwoolf commented 3 years ago

I have encountered this issue when using python3.8.5

Traceback (most recent call last):
  File "m3u8.py", line 275, in <module>
    M3u8().formatter().run()
  File "m3u8.py", line 250, in run
    self.encryptKey = self.getEncryptKey(baseUrl)
  File "m3u8.py", line 103, in getEncryptKey
    encryptKey = self.request("{}/key.key".format(url), None).content
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "m3u8.py", line 196, in request
    response = requests.get(url, params=params, headers=self.headers, timeout=10)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='key.key', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2872e09730>: Failed to establish a new connection: [Errno -2] Name or service not known'))

And below are the full error

碎片的保存路径, 默认./Download:
视频的保存路径, 默认./Complete:
是否清除碎片, 默认False:
url解析关键字, 默认ts:
保存片段格式, 默认ts:
请输入合法的m3u8链接:https://www.chifenghualvlvxingshe.com/20200717/Rcyl5v8g/index.m3u8
---正在分析链接...
---链接分析成功...
---进程开始运行...
Traceback (most recent call last):
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 996, in _validate_conn
    conn.connect()
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connection.py", line 314, in connect
    conn = self._new_conn()
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f2872e09730>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='key.key', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2872e09730>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "m3u8.py", line 275, in <module>
    M3u8().formatter().run()
  File "m3u8.py", line 250, in run
    self.encryptKey = self.getEncryptKey(baseUrl)
  File "m3u8.py", line 103, in getEncryptKey
    encryptKey = self.request("{}/key.key".format(url), None).content
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "m3u8.py", line 196, in request
    response = requests.get(url, params=params, headers=self.headers, timeout=10)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/patricia/Downloads/pyM3u8/venv/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='key.key', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2872e09730>: Failed to establish a new connection: [Errno -2] Name or service not known'))
zhangbo commented 3 years ago

Sorry, m3u8 url is not available right now. Based on this error that might not catch ConnectionError exception. If you get available link, send it here.