使用CSDN-markdown编辑器粘贴代码块时崩溃问题解决
2024-09-05 18:16:59
原因:代码段换行符失效,所有代码一行显示
解决方法:使用Chrome浏览器即可解决(使用Microsoft Edge会出现此问题)
效果展示:
# _*_ coding:utf-8 _*_
import requests
from lxml import etree
import pymongo
client = pymongo.MongoClient('localhost',27017)
mydb = client['mydb']
timeline = mydb['timeline']
def get_time_info(url, page):
user_id = url.split('/')
user_id =user_id[4]
if url.find('page='):
page = page + 1
html = requests.get(url)
selector = etree.HTML(html.text)
infos = selector.xpath('//ul[@class="note-list"]/li')
for info in infos:
dd = info.xpath('div/div/div/span/@data-datetime')[0]
type = info.xpath('div/div/div/span/@data-type')[0]
timeline.insert_one({'date':dd, 'type':type})
id_infos = selector.xpath('//ul[@class="note-list"]/li/@id')
if len(id_infos) >1:
feed_id = id_infos[-1]
max_id = feed_id.split('-')[1]
next_url = 'https://www.jianshu.com/users/%s/timeline?max_id=%s&page=%s' %(user_id, max_id, page)
get_time_info(next_url, page)
if __name__ =='__main__':
get_time_info('https://www.jianshu.com/users/9104ebf5e177/timeline', 1)
最新文章
- cocos2d-x屏幕分辨率,窗口大小总结
- PHP热身
- Linux 中 17 个 tar 命令实用示例
- html5.js让IE(包括IE6)支持HTML5元素方法
- [转载]QString 乱谈(3)-Qt5与中文
- Java基础(47):插入排序的Java封装(含原理,可运行,哨兵位的理解见VisualGo上面的动态分析)
- Android手机_软件安装目录
- leetcode 142. Linked List Cycle II ----- java
- wcf 获取客户端 IP
- 291.	Word Pattern II
- Table of Contents - Nginx
- 陷阱~SQL全表扫描与聚集索引扫描
- 在mysql 中两种锁定问题
- Java日志工具之SLF4J
- Visual Studio For MacOS .NetCore开发踩坑记
- Mysql免安装版配置教程和常用命令图
- Game Engine Architecture 5
- Java学习笔记(二十四):单例设计模式singleton
- 【其他】【PL/SQL Developer】【1】解决PL/SQL Developer过期的情况
- 优秀前端工程师必备:"; checkbox &; radio--单钩 &; 多钩 ";大比较:你是♂||♀ , 还是 ♂&;♀