朝活145日目 API叩いてみる

$ curl -L "https://api.tide736.net/get_tide.php?pc=45&hc=2&yr=2023&mn=5&dy=1&rg=day" | jq .

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   300  100   300    0     0   4587      0 --:--:-- --:--:-- --:--:--  4615
100  9359    0  9359    0     0  66922      0 --:--:-- --:--:-- --:--:-- 66922
{
  "status": 1,
  "message": "正常終了",
  "tide": {
    "port": {
      "prefecture_code": 45,
      "harbor_code": 2,
      "harbor_namej": "外浦",
      "latitude": 31.309999999999998721023075631819665431976318359375,
      "longitude": 131.219999999999998863131622783839702606201171875,
      "level": 118,
      "harbor_name": "Tonoura",
      "tide_type": 2,
      "calc_time": "M36.",
      "sa_ssa": "",
      "calc_way": "不明",
      "observe_public": "",
      "calc_public": "海上保安庁水路部"
    },
    "link": [
      {
        "prefecture_code": 45,
        "harbor_code": 1,
        "harbor_namej": "福島",
        "harbor_name": "Hukusima",
        "latitude": 31.269999999999999573674358543939888477325439453125,
        "longitude": 131.1200000000000045474735088646411895751953125,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 2,
        "harbor_namej": "外浦",
        "harbor_name": "Tonoura",
        "latitude": 31.309999999999998721023075631819665431976318359375,
        "longitude": 131.219999999999998863131622783839702606201171875,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 3,
        "harbor_namej": "油津",
        "harbor_name": "Aburatu",
        "latitude": 31.35000000000000142108547152020037174224853515625,
        "longitude": 131.25,
        "tide_type": 1
      },
      {
        "prefecture_code": 45,
        "harbor_code": 4,
        "harbor_namej": "内海",
        "harbor_name": "Utiumi",
        "latitude": 31.449999999999999289457264239899814128875732421875,
        "longitude": 131.280000000000001136868377216160297393798828125,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 5,
        "harbor_namej": "折生迫",
        "harbor_name": "Oryu^zako",
        "latitude": 31.469999999999998863131622783839702606201171875,
        "longitude": 131.280000000000001136868377216160297393798828125,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 6,
        "harbor_namej": "細島",
        "harbor_name": "Hososima",
        "latitude": 32.25999999999999801048033987171947956085205078125,
        "longitude": 131.400000000000005684341886080801486968994140625,
        "tide_type": 1
      },
      {
        "prefecture_code": 45,
        "harbor_code": 7,
        "harbor_namej": "美々津",
        "harbor_name": "Mimitu",
        "latitude": 32.2000000000000028421709430404007434844970703125,
        "longitude": 131.3700000000000045474735088646411895751953125,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 8,
        "harbor_namej": "土々呂",
        "harbor_name": "Totoro",
        "latitude": 32.2999999999999971578290569595992565155029296875,
        "longitude": 131.409999999999996589394868351519107818603515625,
        "tide_type": 2
      },
      {
        "prefecture_code": 45,
        "harbor_code": 9,
        "harbor_namej": "宮崎",
        "harbor_name": "Miyazaki",
        "latitude": 31.53999999999999914734871708787977695465087890625,
        "longitude": 131.280000000000001136868377216160297393798828125,
        "tide_type": 1
      }
    ],
    "chart": {
      "2023-05-01": {
        "sun": {
          "astro_twilight": [
            "04:02",
            "20:23"
          ],
          "regular_twilight": [
            "05:04",
            "19:20"
          ],
          "rise": "05:30",
          "midline": "12:12",
          "set": "18:54"
        },
        "moon": {
          "brightness": "79.1",
          "age": "10.9",
          "title": "中潮",
          "rise": " 1日 14:38",
          "midline": " 1日 21:10",
          "set": " 2日 03:34",
          "name": null
        },
        "edd": [
          {
            "time": "09:48",
            "unix": 1682902080000,
            "cm": 78.2000000000000028421709430404007434844970703125
          },
          {
            "time": "21:55",
            "unix": 1682945700000,
            "cm": 54.7999999999999971578290569595992565155029296875
          }
        ],
        "flood": [
          {
            "time": "03:43",
            "unix": 1682880180000,
            "cm": 172.900000000000005684341886080801486968994140625
          },
          {
            "time": "15:41",
            "unix": 1682923260000,
            "cm": 167.599999999999994315658113919198513031005859375
          }
        ],
        "tide": [
          {
            "time": "00:00",
            "unix": 1682866800000,
            "cm": 102.900000000000005684341886080801486968994140625
          },
          {
            "time": "00:20",
            "unix": 1682868000000,
            "cm": 112
          },
          {
            "time": "00:40",
            "unix": 1682869200000,
            "cm": 121.2999999999999971578290569595992565155029296875
          },
          {
            "time": "01:00",
            "unix": 1682870400000,
            "cm": 130.30000000000001136868377216160297393798828125
          },
          {
            "time": "01:20",
            "unix": 1682871600000,
            "cm": 139
          },
          {
            "time": "01:40",
            "unix": 1682872800000,
            "cm": 147.099999999999994315658113919198513031005859375
          },
          {
            "time": "02:00",
            "unix": 1682874000000,
            "cm": 154.30000000000001136868377216160297393798828125
          },
          {
            "time": "02:20",
            "unix": 1682875200000,
            "cm": 160.599999999999994315658113919198513031005859375
          },
          {
            "time": "02:40",
            "unix": 1682876400000,
            "cm": 165.69999999999998863131622783839702606201171875
          },
          {
            "time": "03:00",
            "unix": 1682877600000,
            "cm": 169.5
          },
          {
            "time": "03:20",
            "unix": 1682878800000,
            "cm": 171.900000000000005684341886080801486968994140625
          },
          {
            "time": "03:40",
            "unix": 1682880000000,
            "cm": 172.900000000000005684341886080801486968994140625
          },
          {
            "time": "04:00",
            "unix": 1682881200000,
            "cm": 172.5
          },
          {
            "time": "04:20",
            "unix": 1682882400000,
            "cm": 170.599999999999994315658113919198513031005859375
          },
          {
            "time": "04:40",
            "unix": 1682883600000,
            "cm": 167.400000000000005684341886080801486968994140625
          },
          {
            "time": "05:00",
            "unix": 1682884800000,
            "cm": 162.900000000000005684341886080801486968994140625
          },
          {
            "time": "05:20",
            "unix": 1682886000000,
            "cm": 157.400000000000005684341886080801486968994140625
          },
          {
            "time": "05:40",
            "unix": 1682887200000,
            "cm": 150.80000000000001136868377216160297393798828125
          },
          {
            "time": "06:00",
            "unix": 1682888400000,
            "cm": 143.599999999999994315658113919198513031005859375
          },
          {
            "time": "06:20",
            "unix": 1682889600000,
            "cm": 135.80000000000001136868377216160297393798828125
          },
          {
            "time": "06:40",
            "unix": 1682890800000,
            "cm": 127.7000000000000028421709430404007434844970703125
          },
          {
            "time": "07:00",
            "unix": 1682892000000,
            "cm": 119.599999999999994315658113919198513031005859375
          },
          {
            "time": "07:20",
            "unix": 1682893200000,
            "cm": 111.7000000000000028421709430404007434844970703125
          },
          {
            "time": "07:40",
            "unix": 1682894400000,
            "cm": 104.099999999999994315658113919198513031005859375
          },
          {
            "time": "08:00",
            "unix": 1682895600000,
            "cm": 97.2000000000000028421709430404007434844970703125
          },
          {
            "time": "08:20",
            "unix": 1682896800000,
            "cm": 91.099999999999994315658113919198513031005859375
          },
          {
            "time": "08:40",
            "unix": 1682898000000,
            "cm": 86.099999999999994315658113919198513031005859375
          },
          {
            "time": "09:00",
            "unix": 1682899200000,
            "cm": 82.2000000000000028421709430404007434844970703125
          },
          {
            "time": "09:20",
            "unix": 1682900400000,
            "cm": 79.599999999999994315658113919198513031005859375
          },
          {
            "time": "09:40",
            "unix": 1682901600000,
            "cm": 78.2999999999999971578290569595992565155029296875
          },
          {
            "time": "10:00",
            "unix": 1682902800000,
            "cm": 78.5
          },
          {
            "time": "10:20",
            "unix": 1682904000000,
            "cm": 80
          },
          {
            "time": "10:40",
            "unix": 1682905200000,
            "cm": 82.7999999999999971578290569595992565155029296875
          },
          {
            "time": "11:00",
            "unix": 1682906400000,
            "cm": 86.900000000000005684341886080801486968994140625
          },
          {
            "time": "11:20",
            "unix": 1682907600000,
            "cm": 92.099999999999994315658113919198513031005859375
          },
          {
            "time": "11:40",
            "unix": 1682908800000,
            "cm": 98.2000000000000028421709430404007434844970703125
          },
          {
            "time": "12:00",
            "unix": 1682910000000,
            "cm": 105.2000000000000028421709430404007434844970703125
          },
          {
            "time": "12:20",
            "unix": 1682911200000,
            "cm": 112.7000000000000028421709430404007434844970703125
          },
          {
            "time": "12:40",
            "unix": 1682912400000,
            "cm": 120.5
          },
          {
            "time": "13:00",
            "unix": 1682913600000,
            "cm": 128.400000000000005684341886080801486968994140625
          },
          {
            "time": "13:20",
            "unix": 1682914800000,
            "cm": 136.19999999999998863131622783839702606201171875
          },
          {
            "time": "13:40",
            "unix": 1682916000000,
            "cm": 143.5
          },
          {
            "time": "14:00",
            "unix": 1682917200000,
            "cm": 150.19999999999998863131622783839702606201171875
          },
          {
            "time": "14:20",
            "unix": 1682918400000,
            "cm": 156.099999999999994315658113919198513031005859375
          },
          {
            "time": "14:40",
            "unix": 1682919600000,
            "cm": 160.900000000000005684341886080801486968994140625
          },
          {
            "time": "15:00",
            "unix": 1682920800000,
            "cm": 164.5
          },
          {
            "time": "15:20",
            "unix": 1682922000000,
            "cm": 166.69999999999998863131622783839702606201171875
          },
          {
            "time": "15:40",
            "unix": 1682923200000,
            "cm": 167.599999999999994315658113919198513031005859375
          },
          {
            "time": "16:00",
            "unix": 1682924400000,
            "cm": 166.900000000000005684341886080801486968994140625
          },
          {
            "time": "16:20",
            "unix": 1682925600000,
            "cm": 164.80000000000001136868377216160297393798828125
          },
          {
            "time": "16:40",
            "unix": 1682926800000,
            "cm": 161.19999999999998863131622783839702606201171875
          },
          {
            "time": "17:00",
            "unix": 1682928000000,
            "cm": 156.19999999999998863131622783839702606201171875
          },
          {
            "time": "17:20",
            "unix": 1682929200000,
            "cm": 150
          },
          {
            "time": "17:40",
            "unix": 1682930400000,
            "cm": 142.69999999999998863131622783839702606201171875
          },
          {
            "time": "18:00",
            "unix": 1682931600000,
            "cm": 134.5
          },
          {
            "time": "18:20",
            "unix": 1682932800000,
            "cm": 125.599999999999994315658113919198513031005859375
          },
          {
            "time": "18:40",
            "unix": 1682934000000,
            "cm": 116.400000000000005684341886080801486968994140625
          },
          {
            "time": "19:00",
            "unix": 1682935200000,
            "cm": 106.900000000000005684341886080801486968994140625
          },
          {
            "time": "19:20",
            "unix": 1682936400000,
            "cm": 97.5
          },
          {
            "time": "19:40",
            "unix": 1682937600000,
            "cm": 88.5
          },
          {
            "time": "20:00",
            "unix": 1682938800000,
            "cm": 80.2000000000000028421709430404007434844970703125
          },
          {
            "time": "20:20",
            "unix": 1682940000000,
            "cm": 72.7000000000000028421709430404007434844970703125
          },
          {
            "time": "20:40",
            "unix": 1682941200000,
            "cm": 66.2999999999999971578290569595992565155029296875
          },
          {
            "time": "21:00",
            "unix": 1682942400000,
            "cm": 61.10000000000000142108547152020037174224853515625
          },
          {
            "time": "21:20",
            "unix": 1682943600000,
            "cm": 57.39999999999999857891452847979962825775146484375
          },
          {
            "time": "21:40",
            "unix": 1682944800000,
            "cm": 55.2999999999999971578290569595992565155029296875
          },
          {
            "time": "22:00",
            "unix": 1682946000000,
            "cm": 54.7999999999999971578290569595992565155029296875
          },
          {
            "time": "22:20",
            "unix": 1682947200000,
            "cm": 56
          },
          {
            "time": "22:40",
            "unix": 1682948400000,
            "cm": 58.7999999999999971578290569595992565155029296875
          },
          {
            "time": "23:00",
            "unix": 1682949600000,
            "cm": 63.2000000000000028421709430404007434844970703125
          },
          {
            "time": "23:20",
            "unix": 1682950800000,
            "cm": 69.099999999999994315658113919198513031005859375
          },
          {
            "time": "23:40",
            "unix": 1682952000000,
            "cm": 76.2999999999999971578290569595992565155029296875
          },
          {
            "time": "24:00",
            "unix": 1682953200000,
            "cm": 84.599999999999994315658113919198513031005859375
          }
        ]
      }
    }
  }
}
https://api.tide736.net/get_tide.php?pc=45&hc=2&yr=2023&mn=5&dy=1&rg=day

叩いてみた!
レスポンスの説明見るけどいまいちわからない💦

あー
ChatGPTに投げたらこれで叩いてみな!
って

https://api.tide736.net/get_tide.php?pc=45&hc=2&yr=2023&mn=5&dy=1&rg=day" | jq '.tide.chart."2023-05-01
$ curl -L "https://api.tide736.net/get_tide.php?pc=45&hc=2&yr=2023&mn=5&dy=1&rg=day" | jq '.tide.chart."2023-05-01"'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   300  100   300    0     0   4218      0 --:--:-- --:--:-- --:--:--  4225
100  9359    0  9359    0     0  58130      0 --:--:-- --:--:-- --:--:-- 58130
{
  "sun": {
    "astro_twilight": [
      "04:02",
      "20:23"
    ],
    "regular_twilight": [
      "05:04",
      "19:20"
    ],
    "rise": "05:30",
    "midline": "12:12",
    "set": "18:54"
  },
  "moon": {
    "brightness": "79.1",
    "age": "10.9",
    "title": "中潮",
    "rise": " 1日 14:38",
    "midline": " 1日 21:10",
    "set": " 2日 03:34",
    "name": null
  },
  "edd": [
    {
      "time": "09:48",
      "unix": 1682902080000,
      "cm": 78.2000000000000028421709430404007434844970703125
    },
    {
      "time": "21:55",
      "unix": 1682945700000,
      "cm": 54.7999999999999971578290569595992565155029296875
    }
  ],
  "flood": [
    {
      "time": "03:43",
      "unix": 1682880180000,
      "cm": 172.900000000000005684341886080801486968994140625
    },
    {
      "time": "15:41",
      "unix": 1682923260000,
      "cm": 167.599999999999994315658113919198513031005859375
    }
  ],
  "tide": [
    {
      "time": "00:00",
      "unix": 1682866800000,
      "cm": 102.900000000000005684341886080801486968994140625
    },
    {
      "time": "00:20",
      "unix": 1682868000000,
      "cm": 112
    },
以下略

だいぶわかりやすくなった!
公式の説明通りだ!

eddが1日に2回ある干潮の時間を出して、floodが満潮、tideがそれぞれの時間の潮位を表してる!
まあ欲しいのはedd、flood、あとは日の出の時間と大潮とかの情報も欲しいかー

ちゃんと出てたw
日の出がsunのrise、大潮とかの情報がmoonのtitle。

情報は揃った!!

試しにチャートも出してくれるAPI叩いてみよう。

適当に貼り付けたらはみ出た

export default function Chart() {

  return (
    <React.Fragment>
      <Title>Today</Title>
      <div><img style={{ width: '100%', flexGrow: 1, overflow: 'hidden' }} src="https://api.tide736.net/tide_image.php?pc=28&hc=9&yr=2024&mn=5&dy=2&rg=day&w=768&h=512&lc=blue&gcs=cyan&gcf=blue&ld=on&ttd=on&tsmd=on" alt="Tide chart" />
      </div>
    </React.Fragment>
  );
}

ChatGPTの言う通りに変えたら収まった!!

export default function Chart() {
  return (
    <React.Fragment>
      <Title>Today</Title>
      <div style={{ width: '100%', height: 'auto', overflow: 'hidden' }}>
        <img style={{ width: '100%', height: '100%', objectFit: 'contain' }} src="https://api.tide736.net/tide_image.php?pc=28&hc=9&yr=2024&mn=5&dy=2&rg=day&w=768&h=512&lc=blue&gcs=cyan&gcf=blue&ld=on&ttd=on&tsmd=on" alt="Tide chart" />
      </div>
    </React.Fragment>
  );
}


いや、ちっっっっっっっっっっちゃw
サイズ調整

にゃー
cssで調整してと言われた。。。

ので一旦今日はここまでかなー

この記事が気に入ったらサポートをしてみませんか?