command
module
Version:
v0.0.0-...-7d36c00
Opens a new window with list of versions in this module.
Published: Apr 16, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 16
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
豆瓣租房爬虫


下载
https://github.com/itning/DouBanReptile/releases
构建
go build -ldflags="-s -w -H windowsgui" -o ..\bin\main.exe DouBanReptile/cmd
爬取结果文件(markdown)建议使用typora打开
截图





使用教程
确保C:\\Windows\\Fonts\\
目录下有simsun.ttc
字体文件

-
如何设置豆瓣群组链接?
-
首先搜索某个地区租房,例如:北京租房

-
点进去要爬取的某个小组,例如第一个:北京租房
-
将页面拉到最下面有个> 更多小组讨论
超链接,点进去

-
复制地址栏中地址(从/group开始复制到结尾),粘贴到软件设置豆瓣群组链接
有时候粘贴进软件会崩溃,不知道什么原因,建议把软件中原来的链接删除再粘贴进去。


-
将start=
后边的数字50
改成%d

-
完成
-
如何设置排除(包含)关键字?
排除关键字是标题和内容只要出现关键字就会排除掉该条租房信息。
例如默认是限女
这个关键字,只要租房信息中包含限女生入住
,只限女生
等出现限女
关键字的一律不爬。
多个关键字用|
分隔,注意是英文的。
例如:限女|短租|整租
,这三个关键字设置后,只要标题和内容出现这三个关键字软件就不会爬取。
包含关键字只适用于标题,例如包含关键字为A,标题中含A,但内容中不含,会爬取;内容含A,标题不含,不会爬取。
-
关于识别标题中的价格
使用正则\b\d{4}\b
识别标题中的价格信息,无法爬取少于1000元的信息。
-
关于爬取结果排序
先根据价格从小到大排序,价格相同根据发帖时间排序。
-
关于爬取结果文件(.md扩展名)如何打开
建建议下载软件:typora
-
如何设置cookie?
-
打开豆瓣小组,例如:https://www.douban.com/group/554566/discussion?start=0
-
按F12
打开开发者控制台,点击Console
控制台选项卡

-
输入document.cookie
回车,复制内容(注意前后双引号不要复制)

-
将复制的内容粘贴在程序中
测试
操作系统 |
测试结果 |
windows 7 sp1 |
OK |
windows 10 1909 |
OK |
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
internal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.