2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

千葉県 Go To EATの加盟店一覧をCSVに変換

Last updated at Posted at 2020-10-09

千葉県 Go To EAT事業公式サイトの加盟店一覧のPDFをCSVに変換

※10/28現在はPDFがダウンロードできません

wget https://www.chiba-gte.jp/downloads/store_list.pdf -O data.pdf

apt install python3-tk ghostscript
pip install camelot-py[cv]

# 10/9 ※文字数オーバーの場合隣のセルと結合されています
camelot -p all -o data.csv -f csv -split stream -C 97,116,146,365,500 data.pdf

# 10/10以降
camelot -p all -o data.csv -f csv -split stream -C 18,34,50,305,573 data.pdf

地図からスクレイピング

x1,x2,y1,y2は緯度経度

import pandas as pd
import requests

url = "https://gotoeat-chiba.liny.jp/map/api/data.json?x1=35.6053372125437&x2=35.62051386759826&y1=140.09609738558348&y2=140.13085881441648"

r = requests.get(url)
data = r.json()

df = pd.json_normalize(data["data"])

df.to_csv("data.csv", encoding="utf_8_sig)
2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?