Article `download()` failed with HTTPSConnectionPool(host='www.chinanews.com.cn', port=443): Max retries exceeded with url: /cj/2020/12-16/9363925.shtml (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) on URL http://www.chinanews.com/cj/2020/12-16/9363925.shtml
时间: 2024-04-04 22:31:09 浏览: 11
这个错误提示表明您下载该文章时遇到了 SSL 证书验证问题。这可能是由于您的计算机未能验证该网站的 SSL 证书,或者该网站的 SSL 证书存在问题。您可以尝试以下解决方案:
1. 尝试使用不同的浏览器或者在隐私模式下打开浏览器,有时这可以解决 SSL 证书验证问题。
2. 确认您的计算机的日期和时间设置是否正确,因为错误的日期和时间设置可能导致 SSL 证书验证失败。
3. 确认您的计算机是否具有最新的根证书颁发机构列表。您可以尝试更新您的操作系统和浏览器,以获取最新的根证书颁发机构列表。
4. 如果您仍然无法下载该文章,请考虑联系文章的发布者或网站管理员,了解他们是否可以提供其他下载方式或解决 SSL 证书验证问题。
相关问题
<li class="news_other">http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml 2023-06-07 07:24:00 </li>如何将url和时间分别提取出来
可以使用正则表达式来提取。以下是Python代码示例:
```python
import re
html = '<li class="news_other">http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml 2023-06-07 07:24:00 </li>'
url_pattern = re.compile(r'(http://\S+)')
time_pattern = re.compile(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})')
url_match = url_pattern.search(html)
time_match = time_pattern.search(html)
url = url_match.group(1)
time = time_match.group(1)
print('URL:', url)
print('Time:', time)
```
输出结果为:
```
URL: http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml
Time: 2023-06-07 07:24:00
```
<li class="news_other">http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml 2023-06-07 07:24:00 </li>这种如何分别提取url和时间
可以使用正则表达式来提取URL和时间。
提取URL的正则表达式可以是:`<li class="news_other">\s*<a href="(.*?)">`。解释如下:
- `<li class="news_other">` 匹配 `<li class="news_other">` 标签。
- `\s*` 匹配 0 个或多个空格。
- `<a href="` 匹配 `<a href="` 字符串。
- `(.*?)` 使用非贪婪模式匹配任意字符,直到下一个字符串的匹配。
- `">` 匹配 `">` 字符串。
提取时间的正则表达式可以是:`(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})`。解释如下:
- `(` 表示开始一个捕获组。
- `\d{4}-\d{2}-\d{2}` 匹配日期格式,例如 `2023-06-07`。
- `\s+` 匹配 1 个或多个空格。
- `\d{2}:\d{2}:\d{2}` 匹配时间格式,例如 `07:24:00`。
- `)` 表示结束捕获组。
使用 Python 代码可以这样实现:
```python
import re
text = '<li class="news_other">http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml 2023-06-07 07:24:00 </li>'
url_pattern = r'<li class="news_other">\s*<a href="(.*?)">'
time_pattern = r'(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})'
url_match = re.search(url_pattern, text)
if url_match:
url = url_match.group(1)
print(url)
time_match = re.search(time_pattern, text)
if time_match:
time = time_match.group(1)
print(time)
```
输出结果为:
```
http://www.chinanews.com.cn/cj/2023/06-07/10020478.shtml
2023-06-07 07:24:00
```