dmrfcoder / csdnblogtohexo Goto Github PK
View Code? Open in Web Editor NEW基于python实现将csdn的博客文章爬取并转换为hexo下的markdown博客格式
基于python实现将csdn的博客文章爬取并转换为hexo下的markdown博客格式
详细错误信息:
The code that caused this warning is on line 39 of the file export_csdn_mds.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.
soup = BeautifulSoup(item_html.text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Traceback (most recent call last):
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 360, in _error_catcher
yield
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 669, in read_chunked
chunk = self._handle_chunk(amt)
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 624, in _handle_chunk
returned_chunk = self._fp._safe_read(self.chunk_left)
File "G:\python-3.7.1\lib\http\client.py", line 610, in _safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
File "G:\python-3.7.1\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "G:\python-3.7.1\lib\ssl.py", line 1052, in recv_into
return self.read(nbytes, buffer)
File "G:\python-3.7.1\lib\ssl.py", line 911, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "G:\python-3.7.1\lib\site-packages\requests\models.py", line 750, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 490, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 694, in read_chunked
self._original_response.close()
File "G:\python-3.7.1\lib\contextlib.py", line 130, in exit
self.gen.throw(type, value, traceback)
File "G:\python-3.7.1\lib\site-packages\urllib3\response.py", line 365, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='blog.csdn.net', port=443): Read timed out.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "export_csdn_mds.py", line 171, in
start_spider(username)
File "export_csdn_mds.py", line 161, in start_spider
CrawlingItemBlog(base_url, articleid)
File "export_csdn_mds.py", line 26, in CrawlingItemBlog
item_html = request_get(url)
File "export_csdn_mds.py", line 18, in request_get
response = requests.get(url, headers=headers, timeout=3)
File "G:\python-3.7.1\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "G:\python-3.7.1\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "G:\python-3.7.1\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "G:\python-3.7.1\lib\site-packages\requests\sessions.py", line 686, in send
r.content
File "G:\python-3.7.1\lib\site-packages\requests\models.py", line 828, in content
self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
File "G:\python-3.7.1\lib\site-packages\requests\models.py", line 757, in generate
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='blog.csdn.net', port=443): Read timed out.
</details>
爬取下来的md文件中的图片链接img-后面总是会有一个换行符,导致图片链接不正常。
可能是由于html2text在转换html为markdown时内部未处理好。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.