回答編集履歴
1
JSONに変換を追記
test
CHANGED
@@ -51,3 +51,39 @@
|
|
51
51
|
こちらからJavascriptの配列を取得できるのでJSONに変換できそうです
|
52
52
|
|
53
53
|
https://www.jrf-reit.com/common/data/object_list.js
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
# JSONに変換
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
```python
|
62
|
+
|
63
|
+
import requests
|
64
|
+
|
65
|
+
import pandas as pd
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
url = 'https://www.jrf-reit.com/common/data/object_list.js'
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
r = requests.get(url)
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
# 変数名と;を除去
|
78
|
+
|
79
|
+
j = r.text.replace("var PORTFOLIO_DATA = ", "").replace('\t"', '"').replace('];', ']')
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
df = pd.read_json(j)
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
df.to_csv("result.csv")
|
88
|
+
|
89
|
+
```
|