xuzhengyi1995 / Manga_downloader

A Manga download framework using selenium.
654 stars 58 forks source link

mac平台下载BWJP漫画时无法运行 #39

Closed shawncafu closed 3 years ago

shawncafu commented 3 years ago

小白 不懂编程 烦请作者大大看看我这个报错是什么原因?系统是macOS11.2.3,M1,Chrome90 之前用另外一个软件运行的时候python是没有问题的,pillow和selenium还有Google chrome Drivers也都装了

运行之后提示: ======================================= RESTART: /Users/bieguni/Downloads/BW/Manga_downloader-master/main.py ======================================= Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1346, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 950, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/bieguni/Downloads/BW/Manga_downloader-master/main.py", line 40, in downloader = Downloader(*settings) File "/Users/bieguni/Downloads/BW/Manga_downloader-master/downloader.py", line 64, in init self.init_function() File "/Users/bieguni/Downloads/BW/Manga_downloader-master/downloader.py", line 116, in init_function self.get_driver() File "/Users/bieguni/Downloads/BW/Manga_downloader-master/downloader.py", line 91, in get_driver self.driver = uc.Chrome(options=option) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/undetected_chromedriver/init.py", line 43, in new ChromeDriverManager(args, *kwargs).install() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/undetected_chromedriver/init.py", line 144, in init self.target_version = self.get_release_version_number().version[ File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/undetected_chromedriver/init.py", line 209, in get_release_version_number return LooseVersion(urlopen(self.class.DL_BASE + path).read().decode()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1389, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1349, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>

另外这是我main.py里面的内容,不知哪里填错了 ''' Main file '''

from downloader import Downloader

settings = {

Manga urls, should be the same website

'manga_url': [
    'https://member.bookwalker.jp/app/03/webstore/cooperation?r=BROWSER_VIEWER/fa14a7e6-93b4-4e21-8780-a4ae28972d26/https%3A%2F%2Fbookwalker.jp%2FholdBooks%2F&_ga=2.149965814.1581131755.1618962411-1497846737.1618314024',
    'URL_2'
],
# Your cookies
'cookies': 'DO_NOT_MAKE_YOUR_COOKIE_PUBLIC',
# Folder names to store the Manga, the same order with manga_url
'imgdir': [
    '/Users/bieguni/Downloads/BW',
    'IMGDIR_FOR_URL_2'
],
# Resolution, (Width, Height), For coma this doesn't matter.
'res': (784, 1200),
# Sleep time for each page (Second), normally no need to change.
'sleep_time': 1,
# Time wait for page loading (Second), if your network is good, you can reduce this parameter.
'loading_wait_time': 20,
# Cut image, (left, upper, right, lower) in pixel, None means do not cut the image. This often used to cut the edge.
# Like (0, 0, 0, 3) means cut 3 pixel from bottom of the image.
'cut_image': None,
# File name prefix, if you want your file name like 'klk_v1_001.jpg', write 'klk_v1' here.
'file_name_prefix': '',
# File name digits count, if you want your file name like '001.jpg', write 3 here.
'number_of_digits': 3,
# Start page, if you want to download from 3 page, set this to 3, None means from 0
'start_page': None,
# End page, if you want to download until 10 page, set this to 10, None means until finished
'end_page': None,

}

if name == 'main': downloader = Downloader(**settings) downloader.download()

shawncafu commented 3 years ago

似乎是macOS下SSL证书错误 找到一个方法: 曾几何时,我偶然发现了这个问题。如果您使用的是macOS,请转至Macintosh HD>应用程序> Python3.6文件夹(或您使用的任何版本的python)>双击“ Install Certificates.command”文件。:D

成功了ORZ,macOS好麻烦

xuzhengyi1995 commented 3 years ago

您好,

非常感谢您分享您解决问题的经验!

另外还请注意,请不要在任何公共场合暴露您的cookie,这会导致您的账户存在风险,目前已将其删除,还请尽快登出您的账户并重新登录,谢谢!

感谢您的分享,祝好!

shawncafu commented 3 years ago

您好,

非常感谢您分享您解决问题的经验!

另外还请注意,请不要在任何公共场合暴露您的cookie,这会导致您的账户存在风险,目前已将其删除,还请尽快登出您的账户并重新登录,谢谢!

感谢您的分享,祝好!

感谢提醒,已重新登录