diff --git a/README.md b/README.md index be5e6b6..8860478 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,15 @@ ## 亮点 1、保存**回答**到**pdf**、**markdown**,并保存相应的图片、codes以及website,排版基本按照网页,**支持保存数学公式到markdown**,回答会保存提问和自己的回答
-###### 20230729 使用BeautifulSoup库来进行解析网页,使用起来更加稳定的,之前是使用的selenium - 2、保存**article**到**pdf**、**markdown**,并保存相应的图片、codes以及website,排版基本按照网页,**支持保存数学公式到markdown**
3、保存**想法**到text并保存相应的图片,最后对所有text进行汇总到一个档案
+ +## LOG +-----------20230729 使用BeautifulSoup库来进行解析网页,使用起来更加稳定的而且排版更加贴近网页,之前是使用的selenium + +-----------202306 上传 + ### 爬取到的想法展示 按照发布时间分目录存放,保存了图片以及文本文件
点击即可进入think目录查看的
@@ -69,20 +73,24 @@ python.exe crawler.py --think ` **爬取知乎回答**
-默认的爬取每篇回答的睡眠时间是**16s**以上,这边实际爬取耗时平均是每篇 **30s**,每个图片需要6s
+默认的爬取每篇回答的睡眠时间是**16s**以上,这边实际爬取耗时平均是每篇 **30s**每个图片需要6s, --MarkDown控制是否保存markdown格式的网页内容
+ +若是PDF看起来版式太大,调小参数就可以printop.scale,不是特殊情况一般不用调整 + ` -python.exe crawler.py --answer +python.exe crawler.py --answer --MarkDown ` **爬取知乎的article**
-默认的爬取每篇article的睡眠时间是**16s**以上,这边实际爬取130多篇,耗时平均是每篇 **33.096s**,每个图片需要6s
+默认的爬取每篇article的睡眠时间是**16s**以上,这边实际爬取130多篇,耗时平均是每篇 **33.096s**每个图片需要6s
+ ` -python.exe crawler.py --article +python.exe crawler.py --article --MarkDown ` ### 3、三项一起爬取的
` -python.exe crawler.py --think --article --answer +python.exe crawler.py --think --article --answer --MarkDown ` ### 又发布了一篇,只爬取写的这篇 diff --git a/crawler.py b/crawler.py index f9152c3..79ba7fb 100644 --- a/crawler.py +++ b/crawler.py @@ -687,15 +687,15 @@ def pagetopdf(driver, dircrea, temp_name, nam, destdir, url, Created=""): pass printop = PrintOptions() - # printop.shrink_to_fit = True + printop.shrink_to_fit = True # printop.margin_left = 0 # printop.margin_right = 0 # printop.margin_top = 0 # printop.margin_bottom = 0 - printop.page_height = 29.7 - printop.page_width = 21 + # printop.page_height = 29.7 + # printop.page_width = 21 printop.background = True - # printop.scale = 1.0 + printop.scale = 1.0 pdf = driver.print_page(print_options=printop) with open(os.path.join(dircrea, nam + ".pdf"), 'wb') as obj: @@ -1039,14 +1039,14 @@ if __name__ == "__main__": MarkDown_FORMAT = args.MarkDown # crawl_think = False - # crawl_article = False + # crawl_article = True # crawl_answer = True # crawl_links_scratch = False # MarkDown_FORMAT = True # python.exe c:/Users/10696/Desktop/access/zhihu/crawler.py --think --MarkDown # python.exe c:/Users/10696/Desktop/access/zhihu/crawler.py --article --MarkDown # python.exe c:/Users/10696/Desktop/access/zhihu/crawler.py --answer --MarkDown - # python.exe c:/Users/10696/Desktop/access/zhihu/crawler.py --think --answer --article + # python.exe c:/Users/10696/Desktop/access/zhihu/crawler.py --think --answer --article --MarkDown zhihu() # try: # crawl_links_scratch = False diff --git a/requirement.txt b/requirement.txt index 09482f0..0593464 100644 Binary files a/requirement.txt and b/requirement.txt differ