Add 东莞法拍房 historical data: 31 sub-regions, 24,949 records (2017-2026)
Scraped all 31 Dongguan sub-regions using sortField=2 (end-time ascending) to bypass JD's ~4000-item API cap. Merged 34 CSV files by paimaiId into 24,949 unique records covering 2017-07 to 2026-11. Key findings: - 上架量 grew ~50x: 98 (2017) → 4,813 (2026) - 流拍率 peaked at 81.6% (2024), eased to 67.4% (2026) - 樟木头: 558 records, failure rate peaked 94.2% (2024) - 塘厦: 205 records, 2026 failure rate 51.0% Includes: scrape_history.py, batch_scrape_towns.sh, analyze_trends.py, yearly_stats.py, and updated SKILL.md + url_structure.md documenting the 4000-item cap and sub-region scraping strategy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bfbb4e6a26
commit
f06d84a003
@@ -112,12 +112,65 @@ python3 skills/jd-fapai-scrape/scrape.py --keyword 东莞市 --output-dir ../法
|
||||
7. **排序**:保持 API 返回顺序(spo_sortField=11 已按发布时间降序),不重新排序
|
||||
8. **增量合并**:按 `paimaiId` 去重合并,新数据在前,旧数据在后
|
||||
|
||||
## 历史数据抓取(sortField=2)
|
||||
|
||||
默认的 `sortField=11`(最新发布)只返回近期上架的房源。京东平台实际保留了从 **2017年7月** 至今的全部历史成交数据,但需要用 `sortField=2`(按结束时间升序)才能获取。
|
||||
|
||||
### ⚠️ 4000条数据上限
|
||||
|
||||
京东法拍无限滚动有 **~4000条硬性上限**(约100次滚动后API停止返回新数据),无论排序方式如何。这意味着:
|
||||
|
||||
- `sortField=11`(最新发布):返回最近~4000条(约覆盖最近10个月)
|
||||
- `sortField=2`(结束时间升序):返回最早的~4000条(约覆盖2017-07至~2022)
|
||||
|
||||
**无法通过一次搜索获取全量历史数据。** 对于总量超过4000条的城市(如东莞市住宅~20,276条),需要按镇/区分区域抓取。
|
||||
|
||||
### 按镇/区分区域抓取(推荐)
|
||||
|
||||
```bash
|
||||
# 单个镇(数据量通常<4000,可一次抓全)
|
||||
python3 skills/jd-fapai-scrape/scrape_history.py \
|
||||
--keyword 樟木头 --batch-label 樟木头_all \
|
||||
--max-scrolls 200 --output-dir "output/法拍"
|
||||
|
||||
# 批量抓取所有镇(shell脚本循环)
|
||||
for town in 莞城 东城 南城 万江 ... ; do
|
||||
python3 skills/jd-fapai-scrape/scrape_history.py \
|
||||
--keyword "$town" --batch-label "${town}_all" \
|
||||
--max-scrolls 200 --output-dir "output/法拍"
|
||||
done
|
||||
```
|
||||
|
||||
合并时用 `analyze_trends.py` 按 `paimaiId` 去重:
|
||||
```bash
|
||||
python3 skills/jd-fapai-scrape/analyze_trends.py
|
||||
```
|
||||
|
||||
### 大镇的数据缺口
|
||||
|
||||
部分大镇(如东城~3998条、南城~3780条)会接近4000条上限,`sortField=2` 的数据覆盖到~2025年。2025年末至2026年的近期数据可通过原始 `scrape.py`(`sortField=11`)补充,中间有约1年缺口。
|
||||
|
||||
### 数据量参考
|
||||
|
||||
| 关键词 | 类目 | 总记录数 | sortField=2 实际获取 |
|
||||
|--------|------|----------|---------------------|
|
||||
| 东莞市 | 住宅(cate_id=15) | ~20,276 | ~3,995(2017至~2022) |
|
||||
| 樟木头 | 住宅 | ~558 | 558(2018至2026,全覆盖) |
|
||||
| 东城 | 住宅 | ~3,998 | 3,998(2017至~2025,触顶) |
|
||||
| 南城 | 住宅 | ~3,780 | 3,780(2018至~2025,触顶) |
|
||||
|
||||
> 每页约40条,上限约100次滚动≈4000条。单个镇通常1-3分钟完成。
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 京东法拍 API 有风控验证,必须通过浏览器渲染,无法直接调用 API
|
||||
- 页面是 JS SPA,但第一页数据通过 SSR 内嵌在 HTML `<script>` 标签中,需单独提取
|
||||
- API 只返回 page 2+,只拦截 API 会漏掉 page 1(包括最新发布的房源)
|
||||
- URL 中的位置参数(`tttparams`、`spo_lat`、`spo_lng`)影响搜索结果范围
|
||||
- API 每页约 40 条,东莞市全量约 4000 条(可能为 API 上限)
|
||||
- API 每页约 40 条,无限滚动约 100 次后停止返回新数据(~4000 条硬性上限),非滚动次数限制
|
||||
- 历史数据(`sortField=2`)最早到 2017年7月,更早的数据平台已下架
|
||||
- 京东法拍无独立"已结束"tab,`sortField=2` 是获取历史成交的唯一方式
|
||||
- 大城市(如东莞市)总量超过4000条,需按镇/区分区域抓取才能获取全量历史数据
|
||||
- `scrape_history.py` 的 `getPaimaiCurrentInfoByIdsForApi` 响应捕获需要足够等待时间(初始5秒、滚动间隔3秒),否则结束时间等字段可能为空
|
||||
- 拍卖标签(一拍/二拍)仅对部分数据能从 API 获取,其余从折扣率推断
|
||||
- 同一房产的多次拍卖(一拍流拍后二拍)有不同的 `paimaiId`,各自独立保留
|
||||
|
||||
Reference in New Issue
Block a user