Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- fetch("https://www.hoyts.com.au/api/movie/tiles?cinemaIds=SHOWGR&startTime=2021-05-28", {
- "headers": {
- "accept": "application/json, text/plain, */*",
- "accept-language": "en-GB,en;q=0.9",
- "cache-control": "no-cache",
- "pragma": "no-cache",
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"",
- "sec-ch-ua-mobile": "?0",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-origin",
- },
- "referrer": "https://www.hoyts.com.au/movies?selectedDate=2021-05-28&view=list",
- "referrerPolicy": "strict-origin-when-cross-origin",
- "body": null,
- "method": "GET",
- "mode": "cors",
- "credentials": "omit"
- })
- .then(res => res.json())
- .then(list => list.filter(item => item.componentType === 'MovieTileComponent'))
- .then(list => list.flatMap(item => item.sessions))
- .then(list => list.map(session => ({ cinemaId: session.screenName, capacity: session.sessionCapacity.availableSeats })))
- .then(sessions => sessions.reduce((cinemaMap, session) => {
- if (!cinemaMap[session.cinemaId] || cinemaMap[session.cinemaId] < session.capacity) {
- cinemaMap[session.cinemaId] = session.capacity;
- }
- return cinemaMap;
- }, {}))
- .then(console.log);
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement