export default { async fetch(request) { const apiUrl = 'https://vmndmdl.foxsports.com.au/api/web/asset/7099/play?app_name=webapp&protocol=hls'; const headers = { 'Accept': 'application/json;v=2', 'Accept-Language': 'id;q=0.5', 'Authorization': 'Bearer 119ca4c7-2017-4c15-bf77-cdb66a2b681b', 'Content-Type': 'application/json;v=2', 'Origin': 'https://www.watchafl.com.au', 'Priority': 'u=1, i', 'Referer': 'https://www.watchafl.com.au/', 'Sec-CH-UA': '"Not A(Brand";v="8", "Chromium";v="132", "Brave";v="132"', 'Sec-CH-UA-Mobile': '?0', 'Sec-CH-UA-Platform': '"Windows"', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'cross-site', 'Sec-GPC': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36', 'X-Vimond-Tenant': 'foxsport' }; const postData = JSON.stringify({ "playRequest": { "authorize": { "device": { "udid": "9863cc3f-a6d0-408f-847a-82720b78aaae", "label": "Chrome Windows 10" } } } }); const response = await fetch(apiUrl, { method: 'POST', headers: headers, body: postData }); const responseData = await response.json(); // Parse the response as JSON // Extract the 'url' from the playbackItems array const videoUrl = responseData.playbackItems[0]?.url; // Redirect to the extracted URL return Response.redirect(videoUrl, 302); // 302 is a temporary redirect } };