Created
March 4, 2025 15:26
-
-
Save Cayahuanca/e2fee512d8c37e62043940bdec9b474b to your computer and use it in GitHub Desktop.
JR西日本 e5489 の、サンライズの検索 URL を生成する。e5489 の画面では、席種や出雲・瀬戸を切り替えるたびに、日付や乗車駅を入力し直しになり、非常に面倒くさいが、その手間を省略する。姫路より西側の、分離以降は対応していない。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>サンライズ検索</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
background-color: #f4f4f4; | |
margin: 0; | |
padding: 20px; | |
} | |
h2 { | |
color: #333; | |
text-align: center; | |
} | |
form { | |
background-color: white; | |
padding: 20px; | |
border-radius: 5px; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |
} | |
label { | |
display: block; | |
margin-bottom: 10px; | |
font-weight: bold; | |
} | |
select, input { | |
width: 100%; | |
padding: 8px; | |
border: 1px solid #ccc; | |
border-radius: 4px; | |
box-sizing: border-box; | |
} | |
button { | |
background-color: #4CAF50; | |
color: white; | |
padding: 10px 20px; | |
border: none; | |
border-radius: 4px; | |
cursor: pointer; | |
display: block; | |
margin: 20px auto 0; | |
} | |
button:hover { | |
background-color: #45a049; | |
} | |
#result { | |
margin-top: 20px; | |
text-align: center; | |
} | |
#result a { | |
color: #4CAF50; | |
text-decoration: none; | |
} | |
#result a:hover { | |
text-decoration: underline; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>サンライズ検索</h2> | |
<form id="searchForm"> | |
<label>上り/下り: | |
<select id="direction"> | |
<option value="down">下り</option> | |
<option value="up">上り</option> | |
</select> | |
</label><br> | |
<label>発車駅: | |
<select id="departStation"></select> | |
</label><br> | |
<label>到着駅: | |
<select id="arriveStation"></select> | |
</label><br> | |
<label>乗車日: | |
<input type="date" id="inputDate" required> | |
</label><br> | |
<label>客席種別: | |
<select id="seatType"> | |
<option value="%BB%BE%C4%20%20000">のびのび座席+シングルツイン+シングルデラックス(瀬戸)</option> | |
<option value="%BB%B2%BD%D3%20000">のびのび座席+シングルツイン+シングルデラックス(出雲)</option> | |
<option value="%BB%BE%C4%BC%20000">シングル(瀬戸)</option> | |
<option value="%BB%B2%BD%D3%BC000">シングル(出雲)</option> | |
<option value="%BB%BE%C4%BF%20000">ソロ(瀬戸)</option> | |
<option value="%BB%B2%BD%D3%BF000">ソロ(出雲)</option> | |
</select> | |
</label><br> | |
<button type="button" onclick="generateURL()">検索URLを生成</button> | |
</form> | |
<br> | |
<form id="resultForm"> | |
<label>URL: | |
<input type="text" id="urlBox" readonly> | |
<p id="result"></p> | |
<p id="message"></p> | |
</label> | |
</form> | |
<br> | |
<form id="adminMessage"> | |
<p>※このページの制作者と、JR 各社は関係ありません。自己責任で使用し、JR 各社への問い合せは控えてください。仕様変更等により、不具合が生じた場合は、使用を中止してください。</p> | |
<p>このページは、サンライズ列車の予約ページへのリンクを生成するためのツールです。e5489 だと、席種を変えるたびに、日付などを入力し直しになって面倒なので……</p> | |
<p>以下のような URL に、対応するパラメータを自動で埋め込んで、リンクを生成します。リンクをクリックすると、JR の予約ページに飛びます。 | |
<br>https://e5489.jr-odekake.net/e5489/cspc/CBDayTimeArriveSelRsvMyDiaPC?inputDepartStName=[発車駅]&inputArriveStName=[到着駅]&inputDate=[日付8桁 (例: 20250101)]&inputHour=[時2桁 (例: 23)]&inputMinute=[分2桁 (例: 00)]&inputUniqueDepartSt=1&inputUniqueArriveSt=1&inputSearchType=1&inputSpecificBriefTrainKana1=[瀬戸・出雲と、席種類] | |
</p> | |
<p>各パラメータは、以下の内容が入力されます</p> | |
<p>inputDepartStName, inputArriveStName: 駅名 | |
<br>東京駅 %93%8C%8B%9E, 横浜駅 %89%A1%95l, 熱海駅 %94M%8AC, 沼津駅 %8F%C0%92%C3, 富士駅 %95x%8Em, 静岡駅 %90%C3%89%AA, 浜松駅(くだり) %95l%8F%BC, 大阪駅(のぼり) %91%E5%8D%E3, 三ノ宮駅(のぼり) %8EO%83m%8B%7B, 姫路駅 %95P%98H | |
</p> | |
<p>inputDate: 乗車日 | |
<br>年4桁、月日各2桁をつなげた8桁。1か月とさらに1週間前同曜日から事前申込、1か月前から切符購入が可能で、ページが表示できます。それ以降の日付、過去の日付は、表示できません。 | |
</p> | |
<p>inputHour, inputMinute: 乗車時刻 | |
<br>5分単位で指定が可能です。発車時刻よりも前になっている必要があり、乗車駅を24時以降に発車する列車は、23時00分として検索する必要があります。 | |
</p> | |
<p>inputSpecificBriefTrainKana1: 席種 | |
<br>のびのび座席(B寝台普通) シングルツイン(B寝台) シングルデラックス(A寝台) 瀬戸 %BB%BE%C4%20%20000, のびのび座席(B寝台普通) シングルツイン(B寝台) シングルデラックス(A寝台) 出雲 %BB%B2%BD%D3%20000 | |
<br>シングル(B寝台) 瀬戸 %BB%BE%C4%BC%20000, シングル(B寝台) 出雲 %BB%B2%BD%D3%BC000 | |
<br>ソロ(B寝台) 瀬戸 %BB%BE%C4%BF%20000, ソロ(B寝台) 出雲 %BB%B2%BD%D3%BF000 | |
</p> | |
</form> | |
<script> | |
const trainTimes = { | |
down: { "東京": "21:50", "横浜": "22:15", "熱海": "23:23", "沼津": "23:39", "富士": "23:53", "静岡": "24:20", "浜松": "25:12", "姫路": "29:25" }, | |
up: { "姫路": "23:33", "三ノ宮": "24:11", "大阪": "24:33", "静岡": "28:38", "富士": "29:09", "沼津": "29:26", "熱海": "29:43", "横浜": "30:44", "東京": "31:08" } | |
}; | |
const stations = { | |
down: ["東京", "横浜", "熱海", "沼津", "富士", "静岡", "浜松", "姫路"], | |
up: ["姫路", "三ノ宮", "大阪", "静岡", "富士", "沼津", "熱海", "横浜", "東京"] | |
}; | |
const stationCodes = { | |
"東京": "%93%8C%8B%9E", "横浜": "%89%A1%95l", "熱海": "%94M%8AC", "沼津": "%8F%C0%92%C3", | |
"富士": "%95x%8Em", "静岡": "%90%C3%89%AA", "浜松": "%95l%8F%BC", "大阪": "%91%E5%8D%E3", | |
"三ノ宮": "%8EO%83m%8B%7B", "姫路": "%95P%98H" | |
}; | |
function populateStations() { | |
const direction = document.getElementById("direction").value; | |
const departSelect = document.getElementById("departStation"); | |
const arriveSelect = document.getElementById("arriveStation"); | |
departSelect.innerHTML = ""; | |
arriveSelect.innerHTML = ""; | |
stations[direction].forEach(station => { | |
const option = new Option(station, stationCodes[station]); | |
departSelect.add(option.cloneNode(true)); | |
arriveSelect.add(option); | |
}); | |
} | |
document.getElementById("direction").addEventListener("change", populateStations); | |
populateStations(); | |
function setMinMaxDate() { | |
const today = new Date(); | |
const maxDate = new Date(); | |
maxDate.setMonth(today.getMonth() + 1); | |
maxDate.setDate(today.getDate() + 8); | |
document.getElementById("inputDate").min = today.toISOString().split('T')[0]; | |
document.getElementById("inputDate").max = maxDate.toISOString().split('T')[0]; | |
} | |
setMinMaxDate(); | |
function generateURL() { | |
const direction = document.getElementById("direction").value; | |
const departStation = document.getElementById("departStation").value; | |
const arriveStation = document.getElementById("arriveStation").value; | |
const inputDate = document.getElementById("inputDate").value.replace(/-/g, ""); | |
const departStationName = Object.keys(stationCodes).find(key => stationCodes[key] === departStation); | |
let inputTime = trainTimes[direction][departStationName]; | |
const seatType = document.getElementById("seatType").value; | |
if (departStation === arriveStation) { | |
document.getElementById("message").innerHTML = "発車駅と到着駅が同じです。"; | |
return; | |
} | |
if (inputDate === "") { | |
document.getElementById("message").innerHTML = "乗車日を入力してください。"; | |
return; | |
} | |
document.getElementById("message").innerHTML = ""; | |
const url = `https://e5489.jr-odekake.net/e5489/cspc/CBDayTimeArriveSelRsvMyDiaPC?inputDepartStName=${departStation}&inputArriveStName=${arriveStation}&inputDate=${inputDate}&inputHour=${inputTime.split(':')[0]}&inputMinute=${inputTime.split(':')[1]}&inputUniqueDepartSt=1&inputUniqueArriveSt=1&inputSearchType=1&inputSpecificBriefTrainKana1=${seatType}&inputReturnUrl=goyoyaku/campaign/sunriseseto_izumo/form.html`; | |
document.getElementById("result").innerHTML = `<button type=“button” onclick="location.href='${url}'">検索ページへ</button>`; | |
document.getElementById("urlBox").value = url; | |
} | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
乗車日 inputDate (必須) | |
YYYYMMDD | |
発車時刻(時) inputHour (必須) | |
hh | |
発車時刻(分) inputMinute (必須) | |
mm | |
下り時刻: 東京 2150, 横浜 2215, 熱海 2323, 沼津 2339, 富士 2353, 静岡 0020, 浜松 0112, 姫路 0525 | |
上り時刻: 姫路 2333, 三ノ宮 0011, 大阪 0033, 静岡 0438, 富士 0509, 沼津 0526, 熱海 0543, 横浜 0644, 東京 0708 | |
乗車駅 inputDepartStName, inputTransferDepartStName1 (必須) | |
到着駅 inputArriveStName, inputTransferArriveStName1 (必須) | |
東京駅 = %93%8C%8B%9E | |
横浜駅 = %89%A1%95l | |
熱海駅 = %94M%8AC | |
沼津駅 = %8F%C0%92%C3 | |
富士駅 = %95x%8Em | |
静岡駅 = %90%C3%89%AA | |
浜松駅(くだり) = %95l%8F%BC | |
大阪駅(のぼり) = %91%E5%8D%E3 | |
三ノ宮駅(のぼり) = %8EO%83m%8B%7B | |
姫路駅 = %95P%98H | |
座席・車両名種別 inputSpecificBriefTrainKana1 (必須) | |
のびのび座席(B寝台普通) シングルツイン(B寝台) シングルデラックス(A寝台), 瀬戸 = %BB%BE%C4%20%20000 | |
のびのび座席(B寝台普通) シングルツイン(B寝台) シングルデラックス(A寝台), 出雲 = %BB%B2%BD%D3%20000 | |
シングル(B寝台), 瀬戸 = %BB%BE%C4%BC%20000 | |
シングル(B寝台), 出雲 = %BB%B2%BD%D3%BC000 | |
ソロ(B寝台), 瀬戸 = %BB%BE%C4%BF%20000 | |
ソロ(B寝台), 出雲 = %BB%B2%BD%D3%BF000 | |
エラー 直通区間1特定列車略カナを入力・選択してください。 = (消す) | |
inputUniqueDepartSt = 1 (必須) | |
inputUniqueArriveSt = 1 (必須) | |
入れないと、発着駅の選択画面になる。 | |
初期値 = 1 | |
inputSearchType | |
検索条件の "検索方法" に対応する。 | |
乗り換えなしの出雲と瀬戸の2つを同時に調べられる。"一度も乗り換えしない" = 1 | |
初期値、出雲か瀬戸の指定した方のサンライズで乗り換えなし。"乗り換えせず利用する区間を指定" = 2 | |
乗り換えなしの出雲か瀬戸の指定した方 + 出雲か瀬戸の指定した方で熱海でこだまに乗り換えが出てくる。"通常の検索" = (消す) | |
inputSpecificTrainType1 | |
初期値 = 2 | |
初期値と同じになる = 1 | |
この列車を変更 というボタンが表示され、違う席種を一気に見れる = (消す) | |
inputTransferDepartStUnique1 = 1 | |
inputTransferArriveStUnique1 = 1 | |
不要 | |
inputTransferTrainType1 = 0001 | |
不要 | |
SequenceType = 0 | |
不要 | |
inputReturnUrl | |
戻り先の URL。不要 | |
最短の URL。 ↓出発駅 ↓到着駅 ↓乗車日 ↓発車時刻(時) ↓発車時刻(分) ↓必須(1) ↓必須(1) ↓乗り換え ↓サンライズの客席種別 | |
https://e5489.jr-odekake.net/e5489/cspc/CBDayTimeArriveSelRsvMyDiaPC?inputDepartStName=(乗車駅)&inputArriveStName=(到着駅)&inputDate=YYYYMMDD&inputHour=hh&inputMinute=mm&inputUniqueDepartSt=1&inputUniqueArriveSt=1&inputSearchType=1&inputSpecificBriefTrainKana1=(サンライズの客席種別) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment