Skip to content

Instantly share code, notes, and snippets.

@bczhc
Last active March 26, 2022 02:22
Show Gist options
  • Save bczhc/286c6f7035c184bdab9f31b74ffd4581 to your computer and use it in GitHub Desktop.
Save bczhc/286c6f7035c184bdab9f31b74ffd4581 to your computer and use it in GitHub Desktop.
爬取随手记的账单记录
POST https://www.sui.com/report.rmi
content-type: application/x-www-form-urlencoded; charset=UTF-8
cookie: XXX

m=compare&beginDate=2000.1.1&endDate=2022.03.25&cardId=164459304268&page=1

Or

curl -d 'm=compare&beginDate=2000.1.1&endDate=2022.03.25&cardId=164459304268&page=1' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'cookie: COOKIE' \
https://www.sui.com/report.rmi
#!/bin/bash

while read -r p; do
  date_str=$(date -d "@$(("$p"/1000))" '+%Y-%-m-%-d')
  curl -d "m=detail&date=${date_str}&cardId=164459304268" \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'cookie: COOKIE' \
  https://www.sui.com/report.rmi
  echo
done < ./time | tee output
cat output | jq '[.[]] | map([(.name | if . == "支出" then 2 else (if . == "收入" then 1 else (if . == "余额变 更" then 3 else 4 end) end) end), .money, .memo]) | .[]'
@bczhc
Copy link
Author

bczhc commented Mar 26, 2022

我真的用这些操作处理不下去了,只好祭出正经语言了:https://github.com/bczhc/web-scraper/tree/master/suishouji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment