M3U8 Auto Stream Deployer commited on
Commit ·
995c7c5
1
Parent(s): 7ca3816
Deploy full project code with Docker runtime
Browse filesFiles changed (19)
- .dockerignoreAdded+7
- .gitattributesDeleted-35
- .gitignoreAdded+8
- DockerfileAdded+29
- README.md+7-4
- data/config.jsonAdded+545
- decoded_block_0.txtAdded
- index.htmlAdded+13
- metadata.jsonAdded+6
- package.jsonAdded+38
- push-full-project.tsAdded+197
- requirements.txtDeleted
- server.tsAdded+973
- src/App.tsxAdded+973
- src/index.cssAdded+26
- src/main.tsxAdded+10
- tsconfig.jsonAdded+26
- vite.config.tsAdded+22
- yallashoot_playlist.m3uDeleted-65
1234567node_modulesdist.git.github*.logdata/hf_project_push_*data/hf_push_*1234567891011121314151617181920212223242526272829303132333435*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text12345678node_modules/build/dist/coverage/.DS_Store*.log.env*!.env.example1234567891011121314151617181920212223242526272829FROM node:20-slim
WORKDIR /app
# Install gitRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Copy package config filesCOPY package*.json ./
# Install all dependencies (production & development for compilation)RUN npm install
# Copy full sourceCOPY . .
# Build application (generates /dist and /dist/server.cjs)RUN npm run build
# Configure default directory permissionsRUN mkdir -p /app/data && chmod -R 777 /app/data
# Expose Space portEXPOSE 7860ENV PORT=7860ENV NODE_ENV=production
# Start containerCMD ["npm", "run", "start"]12345678910---title: Streamapiemoji: 🐢colorFrom: yellowcolorTo: bluesdk: dockerpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference12345678910111213---title: Streamapiemoji: 📺colorFrom: bluecolorTo: indigosdk: dockerpinned: false---# Live Stream M3U8 ExtractorThis application is hosted on Hugging Face Spaces!It automatically crawls live channels to retrieve M3U8 streaming sources and compiles them into a cached playlist.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545{ "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "referer": "https://11.yallashoot1.cc/", "scrapeIntervalMs": 3600000, "enableHfPush": true, "hfToken": "", "hfSpace": "subrato1/streamapi", "channels": [ { "id": "1", "name": "Yalla Shoot - Server 1", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=1", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.202Z", "logs": [ "[2026-06-23T05:25:13.147Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=1", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "2", "name": "Yalla Shoot - Server 2", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=2", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.210Z", "logs": [ "[2026-06-23T05:25:13.203Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=2", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "3", "name": "Yalla Shoot - Server 3", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=3", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.216Z", "logs": [ "[2026-06-23T05:25:13.210Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=3", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "4", "name": "Yalla Shoot - Server 4", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=4", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.222Z", "logs": [ "[2026-06-23T05:25:13.216Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=4", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "5", "name": "Yalla Shoot - Server 5", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=5", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.233Z", "logs": [ "[2026-06-23T05:25:13.222Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=5", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "6", "name": "Yalla Shoot - Server 6", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=6", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.241Z", "logs": [ "[2026-06-23T05:25:13.233Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=6", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "7", "name": "Yalla Shoot - Server 7", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=7", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.249Z", "logs": [ "[2026-06-23T05:25:13.242Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=7", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "8", "name": "Yalla Shoot - Server 8", "url": "https://11.yallashoot1.cc/albaplayer/ch1/?serv=8", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:13.255Z", "logs": [ "[2026-06-23T05:25:13.250Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?serv=8", "Failed to fetch page: fetch failed", "Failing link discovery. Stream marked offline." ] }, { "id": "9", "name": "Alba Max - Server 1", "url": "https://top.poiy.online/albaplayer/max1/?serv=1", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:14.143Z", "logs": [ "[2026-06-23T05:25:13.256Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=1", "Page fetched successfully. HTML content length: 3501 characters.", "Scanning for Base64 obfuscated URLs...", "Looking for nested frames...", "Could not extract any active .m3u8 link from the page structure directly.", "Failed Page Snippet: <!DOCTYPE html> <html dir=\"rtl\" lang=\"ar\"> <head> <meta charset=\"UTF-8\" /> <link rel=\"profile\" href=\"http://gmpg.org/xfn/11\" /> <link rel=\"icon\" type=\"image/x-icon\" href=\"\"/> <meta content='width=device-width,minimum-scale=1,initial-scale=1' name='viewport'/> <title>max1</title> <link href=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/css/style.css?v=11.1\" rel=\"stylesheet\"> <style>:root{ --aplr-primary:#552a86; --aplr-secondary:#9e1414; --aplr-btn-rds:1px; --aplr-rf-cr:#162133; --aplr-sh-cr:#162133} .jw-wrapper::before, .plyr__video-wrapper::before, #oframeaplr-video::before, #aplr-video.video-js::before{background-image:url();background-position:top right}</style><script>const PlayerPoster='';const PlayerLogo='';const LogoPosition='top-right';</script><script type=\"text/javascript\" src=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/js/albaplayer.js\"></script><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> </head> <body> <div class=\"aplr-player-wrapper nbtn-st-1 nbtn-wd-1 nbtn-sz-m nbtn-pos-t rtl\"> <ul class=\"aplr-menu\"><li><a class=\"aplr-link active\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=1\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=2\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=3\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplay", "Failing link discovery. Stream marked offline." ] }, { "id": "10", "name": "Alba Max - Server 2", "url": "https://top.poiy.online/albaplayer/max1/?serv=2", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://s3.us-east-2.amazonaws.com/cdnh123/hls/0/stream.m3u8", "referer": "https://top.poiy.online/albaplayer/max1/?serv=2", "status": "Active", "lastTested": "2026-06-23T05:25:14.424Z", "logs": [ "[2026-06-23T05:25:14.143Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=2", "Page fetched successfully. HTML content length: 3506 characters.", "Found 1 direct .m3u8 stream links.", "Scrape successful in 281ms. Saved source." ] }, { "id": "11", "name": "Alba Max - Server 3", "url": "https://top.poiy.online/albaplayer/max1/?serv=3", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://edge22.776740.ir.cdn.ir/hls2/sport.m3u8", "referer": "https://top.poiy.online/albaplayer/max1/?serv=3", "status": "Active", "lastTested": "2026-06-23T05:25:14.725Z", "logs": [ "[2026-06-23T05:25:14.424Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=3", "Page fetched successfully. HTML content length: 3440 characters.", "Scanning for Base64 obfuscated URLs...", "Successfully found & decoded obfuscated stream: \"https://edge22.776740.ir.cdn.ir/hls2/sport.m3u8\"", "Scrape successful in 301ms. Saved source." ] }, { "id": "12", "name": "Alba Max - Server 4", "url": "https://top.poiy.online/albaplayer/max1/?serv=4", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:15.012Z", "logs": [ "[2026-06-23T05:25:14.726Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=4", "Page fetched successfully. HTML content length: 3249 characters.", "Scanning for Base64 obfuscated URLs...", "Looking for nested frames...", "Detected iframe source: https://11.yallashoot1.cc/albaplayer/ch1/?", "Entering nested iframe scraper: https://11.yallashoot1.cc/albaplayer/ch1/? (Depth: 1)", " [Nested Frame] [2026-06-23T05:25:15.006Z] Initiating fetch for target: https://11.yallashoot1.cc/albaplayer/ch1/?", " [Nested Frame] Failed to fetch page: fetch failed", "Could not extract any active .m3u8 link from the page structure directly.", "Failed Page Snippet: <!DOCTYPE html> <html dir=\"rtl\" lang=\"ar\"> <head> <meta charset=\"UTF-8\" /> <link rel=\"profile\" href=\"http://gmpg.org/xfn/11\" /> <link rel=\"icon\" type=\"image/x-icon\" href=\"\"/> <meta content='width=device-width,minimum-scale=1,initial-scale=1' name='viewport'/> <title>max1</title> <link href=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/css/style.css?v=11.1\" rel=\"stylesheet\"> <style>:root{ --aplr-primary:#552a86; --aplr-secondary:#9e1414; --aplr-btn-rds:1px; --aplr-rf-cr:#162133; --aplr-sh-cr:#162133} .jw-wrapper::before, .plyr__video-wrapper::before, #oframeaplr-video::before, #aplr-video.video-js::before{background-image:url();background-position:top right}</style><script>const PlayerPoster='';const PlayerLogo='';const LogoPosition='top-right';</script><script type=\"text/javascript\" src=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/js/albaplayer.js\"></script><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> </head> <body> <div class=\"aplr-player-wrapper nbtn-st-1 nbtn-wd-1 nbtn-sz-m nbtn-pos-t rtl\"> <ul class=\"aplr-menu\"><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=1\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=2\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=3\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link active\" href=\"https://topx.poiy.online/albaplay", "Failing link discovery. Stream marked offline." ] }, { "id": "13", "name": "Alba Max - Server 5", "url": "https://top.poiy.online/albaplayer/max1/?serv=5", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": null, "referer": null, "status": "No Stream", "lastTested": "2026-06-23T05:25:15.415Z", "logs": [ "[2026-06-23T05:25:15.012Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=5", "Page fetched successfully. HTML content length: 3245 characters.", "Scanning for Base64 obfuscated URLs...", "Looking for nested frames...", "Detected iframe source: https://s13.yalla-sport.top/ch/ch1.php", "Entering nested iframe scraper: https://s13.yalla-sport.top/ch/ch1.php (Depth: 1)", " [Nested Frame] [2026-06-23T05:25:15.313Z] Initiating fetch for target: https://s13.yalla-sport.top/ch/ch1.php", " [Nested Frame] Failed to fetch page: fetch failed", "Could not extract any active .m3u8 link from the page structure directly.", "Failed Page Snippet: <!DOCTYPE html> <html dir=\"rtl\" lang=\"ar\"> <head> <meta charset=\"UTF-8\" /> <link rel=\"profile\" href=\"http://gmpg.org/xfn/11\" /> <link rel=\"icon\" type=\"image/x-icon\" href=\"\"/> <meta content='width=device-width,minimum-scale=1,initial-scale=1' name='viewport'/> <title>max1</title> <link href=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/css/style.css?v=11.1\" rel=\"stylesheet\"> <style>:root{ --aplr-primary:#552a86; --aplr-secondary:#9e1414; --aplr-btn-rds:1px; --aplr-rf-cr:#162133; --aplr-sh-cr:#162133} .jw-wrapper::before, .plyr__video-wrapper::before, #oframeaplr-video::before, #aplr-video.video-js::before{background-image:url();background-position:top right}</style><script>const PlayerPoster='';const PlayerLogo='';const LogoPosition='top-right';</script><script type=\"text/javascript\" src=\"https://topx.poiy.online/wp-content/plugins/AlbaPlayerrr//assets/js/albaplayer.js\"></script><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> </head> <body> <div class=\"aplr-player-wrapper nbtn-st-1 nbtn-wd-1 nbtn-sz-m nbtn-pos-t rtl\"> <ul class=\"aplr-menu\"><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=1\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=2\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1/?serv=3\" role=\"button\">بث 1</a></li><li><a class=\"aplr-link\" href=\"https://topx.poiy.online/albaplayer/max1", "Failing link discovery. Stream marked offline." ] }, { "id": "14", "name": "Alba Max - Server 6", "url": "https://top.poiy.online/albaplayer/max1/?serv=6", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://n949rkq40t1l.54434687.net:8443/hls/ulgk1vzsw8aqr.m3u8?s=gYgHj9nBkdXtzWlGZCIUqg&e=1782213917", "referer": "https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/", "status": "Active", "lastTested": "2026-06-23T05:25:18.902Z", "logs": [ "[2026-06-23T05:25:15.415Z] Initiating fetch for target: https://top.poiy.online/albaplayer/max1/?serv=6", "Page fetched successfully. HTML content length: 3258 characters.", "Scanning for Base64 obfuscated URLs...", "Looking for nested frames...", "Detected iframe source: https://ww2.sporttsonline.click/channels/hd/hd1.php", "Entering nested iframe scraper: https://ww2.sporttsonline.click/channels/hd/hd1.php (Depth: 1)", " [Nested Frame] [2026-06-23T05:25:15.717Z] Initiating fetch for target: https://ww2.sporttsonline.click/channels/hd/hd1.php", " [Nested Frame] Page fetched successfully. HTML content length: 2854 characters.", " [Nested Frame] Scanning for Base64 obfuscated URLs...", " [Nested Frame] Looking for nested frames...", " [Nested Frame] Detected iframe source: https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/e/9pn3i1loesyis", " [Nested Frame] Entering nested iframe scraper: https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/e/9pn3i1loesyis (Depth: 2)", " [Nested Frame] [Nested Frame] [2026-06-23T05:25:16.203Z] Initiating fetch for target: https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/e/9pn3i1loesyis", " [Nested Frame] [Nested Frame] Page fetched successfully. HTML content length: 150484 characters.", " [Nested Frame] [Nested Frame] Scanning for Base64 obfuscated URLs...", " [Nested Frame] [Nested Frame] Detected dynadopt.net player payload: attempting VM decrypter...", " [Nested Frame] [Nested Frame] Found _econfig string of length 147888", " [Nested Frame] [Nested Frame] Configuring VM execution context and fetching decoding script: https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/assets/stream.js?_v=0.0.19", " [Nested Frame] [Nested Frame] Downloaded stream.js (89523 bytes). Launching secure VM sandbox...", " [Nested Frame] [Nested Frame] VM decryption successful! Found stream source: \"https://n949rkq40t1l.54434687.net:8443/hls/ulgk1vzsw8aqr.m3u8?s=gYgHj9nBkdXtzWlGZCIUqg&e=1782213917\"", "Scrape successful in 3487ms. Saved source." ] }, { "id": "15", "name": "AIO Player - TSN 1", "url": "https://playeraio.top/embed2.php?id=tsn1", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=1EOXM4BabPe40vjYEQI3Nw&expires=1782197119&ch=tsn1ca&s=23043696c6912d6bbb7611f7d30031c7", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:20.895Z", "logs": [ "[2026-06-23T05:25:18.903Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=tsn1", "Extracted player variables: fid=tsn1ca, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=tsn1ca&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=1EOXM4BabPe40vjYEQI3Nw&expires=1782197119&ch=tsn1ca&s=23043696c6912d6bbb7611f7d30031c7", "Stream test status for match 1: 200", "Scrape successful in 1992ms. Saved source." ] }, { "id": "16", "name": "AIO Player - ITV 1", "url": "https://playeraio.top/embed2.php?id=itv1", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/itv111.m3u8?md5=3dY4hELFeXLUrIs3btavAg&expires=1782197121&ch=itv111&s=eb517edddcae6722f178748202c12769", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:22.232Z", "logs": [ "[2026-06-23T05:25:20.896Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=itv1", "Extracted player variables: fid=itv111, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=itv111&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/itv111.m3u8?md5=3dY4hELFeXLUrIs3btavAg&expires=1782197121&ch=itv111&s=eb517edddcae6722f178748202c12769", "Stream test status for match 1: 200", "Scrape successful in 1336ms. Saved source." ] }, { "id": "17", "name": "AIO Player - Premier Sports", "url": "https://playeraio.top/embed2.php?id=premiersp", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/daznlaliga.m3u8?md5=q0Fgjr8bLGhd0e21WI_79g&expires=1782197122&ch=daznlaliga&s=e76e6778b1f4a32bd5dcfde7b3dfea33", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:23.248Z", "logs": [ "[2026-06-23T05:25:22.233Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=premiersp", "Extracted player variables: fid=daznlaliga, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=daznlaliga&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/daznlaliga.m3u8?md5=q0Fgjr8bLGhd0e21WI_79g&expires=1782197122&ch=daznlaliga&s=e76e6778b1f4a32bd5dcfde7b3dfea33", "Stream test status for match 1: 200", "Scrape successful in 1015ms. Saved source." ] }, { "id": "18", "name": "AIO Player - Sports CH 45", "url": "https://playeraio.top/embed2.php?id=spch45", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/spch45.m3u8?md5=VtVLH0EY5QYVKNy-H_ASEA&expires=1782197123&ch=spch45&s=472e48a51eb8b5e4ce1f1dd8509df460", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:24.250Z", "logs": [ "[2026-06-23T05:25:23.249Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=spch45", "Extracted player variables: fid=spch45, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=spch45&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/spch45.m3u8?md5=VtVLH0EY5QYVKNy-H_ASEA&expires=1782197123&ch=spch45&s=472e48a51eb8b5e4ce1f1dd8509df460", "Stream test status for match 1: 200", "Scrape successful in 1001ms. Saved source." ] }, { "id": "19", "name": "AIO Player - Bein Sport 1 FR", "url": "https://playeraio.top/embed2.php?id=bsp1fr", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/bsp1fr.m3u8?md5=ER8O08T2Xm-VNGKAsTwUYQ&expires=1782197124&ch=bsp1fr&s=7c29ace716a6f1c299f52dc44ba72911", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:25.245Z", "logs": [ "[2026-06-23T05:25:24.251Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=bsp1fr", "Extracted player variables: fid=bsp1fr, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=bsp1fr&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/bsp1fr.m3u8?md5=ER8O08T2Xm-VNGKAsTwUYQ&expires=1782197124&ch=bsp1fr&s=7c29ace716a6f1c299f52dc44ba72911", "Stream test status for match 1: 200", "Scrape successful in 994ms. Saved source." ] }, { "id": "20", "name": "AIO Player - ZDF", "url": "https://playeraio.top/embed2.php?id=zdf", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/zdf.m3u8?md5=Jf709eJIDYeaeOykq9wPKw&expires=1782197125&ch=zdf&s=a5ca88224d60e3325ff422b0348ac7e0", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:26.986Z", "logs": [ "[2026-06-23T05:25:25.246Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=zdf", "Extracted player variables: fid=zdf, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=zdf&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/zdf.m3u8?md5=Jf709eJIDYeaeOykq9wPKw&expires=1782197125&ch=zdf&s=a5ca88224d60e3325ff422b0348ac7e0", "Stream test status for match 1: 404", "Testing stream source match 0: https://dz5.bhalocast.pro:7059/hls/zdf.m3u8?md5=4Vz82zhjprkWpvF0KjAutQ&expires=1782192315&ch=zdf&s=a5ca88224d60e3325ff422b0348ac7e0", "Stream test status for match 0: 403", "Fallback to match 1: https://dz5.bhalocast.pro:7059/hls/zdf.m3u8?md5=Jf709eJIDYeaeOykq9wPKw&expires=1782197125&ch=zdf&s=a5ca88224d60e3325ff422b0348ac7e0", "Scrape successful in 1741ms. Saved source." ] }, { "id": "21", "name": "AIO Player - TSN 3", "url": "https://playeraio.top/embed2.php?id=tsn3", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/tsn3ca.m3u8?md5=wtRwMX7Z1gg-y362F-wodg&expires=1782197127&ch=tsn3ca&s=6491bea32288c4c59853db2e534a346a", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:27.988Z", "logs": [ "[2026-06-23T05:25:26.987Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=tsn3", "Extracted player variables: fid=tsn3ca, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=tsn3ca&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/tsn3ca.m3u8?md5=wtRwMX7Z1gg-y362F-wodg&expires=1782197127&ch=tsn3ca&s=6491bea32288c4c59853db2e534a346a", "Stream test status for match 1: 200", "Scrape successful in 1001ms. Saved source." ] }, { "id": "22", "name": "AIO Player - Sports CH 9", "url": "https://playeraio.top/embed2.php?id=spch9", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/spch9.m3u8?md5=UnXgSGQGmA4sD7kVajNM_g&expires=1782197128&ch=spch9&s=3497a1cd012e6f5d5ed5d324f20e701f", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:28.977Z", "logs": [ "[2026-06-23T05:25:27.989Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=spch9", "Extracted player variables: fid=spch9, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=spch9&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/spch9.m3u8?md5=UnXgSGQGmA4sD7kVajNM_g&expires=1782197128&ch=spch9&s=3497a1cd012e6f5d5ed5d324f20e701f", "Stream test status for match 1: 200", "Scrape successful in 988ms. Saved source." ] }, { "id": "23", "name": "AIO Player - TSN 1 CA", "url": "https://playeraio.top/embed2.php?id=tsn1ca", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=XZG-iMNUXEyGCDcuOqBnNQ&expires=1782197129&ch=tsn1ca&s=384d6371c6791399513a02978c34959a", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:29.980Z", "logs": [ "[2026-06-23T05:25:28.978Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=tsn1ca", "Extracted player variables: fid=tsn1ca, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=tsn1ca&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=XZG-iMNUXEyGCDcuOqBnNQ&expires=1782197129&ch=tsn1ca&s=384d6371c6791399513a02978c34959a", "Stream test status for match 1: 200", "Scrape successful in 1002ms. Saved source." ] }, { "id": "24", "name": "AIO Player - BBC 1", "url": "https://playeraio.top/embed2.php?id=bbc1", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/bbc1ld.m3u8?md5=pevdCN1G6vE1npd6cdBzJw&expires=1782197130&ch=bbc1ld&s=fb0e8cc1bac27e81b600d850ebca7fd5", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:31.219Z", "logs": [ "[2026-06-23T05:25:29.980Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=bbc1", "Extracted player variables: fid=bbc1ld, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=bbc1ld&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/bbc1ld.m3u8?md5=pevdCN1G6vE1npd6cdBzJw&expires=1782197130&ch=bbc1ld&s=fb0e8cc1bac27e81b600d850ebca7fd5", "Stream test status for match 1: 404", "Testing stream source match 0: https://dz5.bhalocast.pro:7059/hls/bbc1ld.m3u8?md5=logaSi4xaUWai0zehVMqDg&expires=1782192320&ch=bbc1ld&s=fb0e8cc1bac27e81b600d850ebca7fd5", "Stream test status for match 0: 403", "Fallback to match 1: https://dz5.bhalocast.pro:7059/hls/bbc1ld.m3u8?md5=pevdCN1G6vE1npd6cdBzJw&expires=1782197130&ch=bbc1ld&s=fb0e8cc1bac27e81b600d850ebca7fd5", "Scrape successful in 1239ms. Saved source." ] }, { "id": "25", "name": "AIO Player - Sports CH 10", "url": "https://playeraio.top/embed2.php?id=spch10", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/spch10.m3u8?md5=OSorX_5zX16GE2k-VVjg2A&expires=1782197131&ch=spch10&s=e092c0ef319a4584495f69c2324b7ef5", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:32.193Z", "logs": [ "[2026-06-23T05:25:31.220Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=spch10", "Extracted player variables: fid=spch10, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=spch10&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/spch10.m3u8?md5=OSorX_5zX16GE2k-VVjg2A&expires=1782197131&ch=spch10&s=e092c0ef319a4584495f69c2324b7ef5", "Stream test status for match 1: 200", "Scrape successful in 973ms. Saved source." ] }, { "id": "26", "name": "AIO Player - Sports CH 159", "url": "https://playeraio.top/embed2.php?id=spch159", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/yt39.m3u8?md5=HUk6MQVvruyk44YcA6bC_g&expires=1782197132&ch=yt39&s=41b100aa2f37db1c0cd977290a8f9c91", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:33.169Z", "logs": [ "[2026-06-23T05:25:32.194Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=spch159", "Extracted player variables: fid=yt39, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=yt39&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/yt39.m3u8?md5=HUk6MQVvruyk44YcA6bC_g&expires=1782197132&ch=yt39&s=41b100aa2f37db1c0cd977290a8f9c91", "Stream test status for match 1: 200", "Scrape successful in 975ms. Saved source." ] }, { "id": "27", "name": "AIO Player - Sports CH 41", "url": "https://playeraio.top/embed2.php?id=spch41", "logo": "https://cdn-icons-png.flaticon.com/512/861/861512.png", "overrideUrl": "", "m3u8Url": "https://dz5.bhalocast.pro:7059/hls/spch41.m3u8?md5=L4fe_JqKZKFcL4yEE6MNSg&expires=1782197133&ch=spch41&s=ad2815f3a4007b287306ec035f90da8f", "referer": "https://bhalocast.pro/", "status": "Active", "lastTested": "2026-06-23T05:25:34.387Z", "logs": [ "[2026-06-23T05:25:33.170Z] Initiating PlayerAio premium scraper for: https://playeraio.top/embed2.php?id=spch41", "Extracted player variables: fid=spch41, secure=m1lko, expires=123456", "Fetching decrypted iframe page: https://bhalocast.pro/atofplay.php?v=spch41&secure=m1lko&expires=123456", "Found 2 stream source array matches.", "Testing stream source match 1: https://dz5.bhalocast.pro:7059/hls/spch41.m3u8?md5=L4fe_JqKZKFcL4yEE6MNSg&expires=1782197133&ch=spch41&s=ad2815f3a4007b287306ec035f90da8f", "Stream test status for match 1: 404", "Testing stream source match 0: https://dz5.bhalocast.pro:7059/hls/spch41.m3u8?md5=gI7psoceg50ic8NiF0pMbw&expires=1782192323&ch=spch41&s=ad2815f3a4007b287306ec035f90da8f", "Stream test status for match 0: 403", "Fallback to match 1: https://dz5.bhalocast.pro:7059/hls/spch41.m3u8?md5=L4fe_JqKZKFcL4yEE6MNSg&expires=1782197133&ch=spch41&s=ad2815f3a4007b287306ec035f90da8f", "Scrape successful in 1217ms. Saved source." ] } ], "lastUpdated": "2026-06-23T05:25:34.388Z"}12345678910111213<!doctype html><html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Live Stream M3U8 Extractor & Playlist Generator</title> </head> <body> <div id="root"></div> <script type="module" src="/src/main.tsx"></script> </body></html>
123456{ "name": "Live Stream M3U8 Extractor", "description": "Extractor utility that crawls live channels to retrieve M3U8 streaming sources, headers, and automatically compiles a cached, hourly updated M3U playlist.", "requestFramePermissions": [], "majorCapabilities": ["MAJOR_CAPABILITY_SERVER_SIDE_GEMINI_API"]}1234567891011121314151617181920212223242526272829303132333435363738{ "name": "react-example", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "tsx server.ts", "build": "vite build && esbuild server.ts --bundle --platform=node --format=cjs --packages=external --sourcemap --outfile=dist/server.cjs", "start": "node dist/server.cjs", "clean": "rm -rf dist server.js", "lint": "tsc --noEmit" }, "dependencies": { "@google/genai": "^2.4.0", "@tailwindcss/vite": "^4.1.14", "@types/jsdom": "^28.0.3", "@vitejs/plugin-react": "^5.0.4", "dotenv": "^17.2.3", "express": "^4.21.2", "hls.js": "^1.6.16", "jsdom": "^29.1.1", "lucide-react": "^0.546.0", "motion": "^12.23.24", "react": "^19.0.1", "react-dom": "^19.0.1", "vite": "^6.2.3" }, "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^22.14.0", "autoprefixer": "^10.4.21", "esbuild": "^0.25.0", "tailwindcss": "^4.1.14", "tsx": "^4.21.0", "typescript": "~5.8.2", "vite": "^6.2.3" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197import fs from "fs";import path from "path";import { execSync } from "child_process";
// 1. Read config to get token and space targetconst CONFIG_PATH = path.join(process.cwd(), "data", "config.json");if (!fs.existsSync(CONFIG_PATH)) { console.error("Config file not found at", CONFIG_PATH); process.exit(1);}
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, "utf-8"));const token = config.hfToken;const space = config.hfSpace;
if (!token || !space) { console.error("Hugging Face space path or token is missing from config.json!"); console.error("Current settings: Space:", space, "Token:", token ? "FOUND" : "MISSING"); process.exit(1);}
const tempDir = path.join(process.cwd(), "data", `hf_project_push_${Date.now()}`);console.log(`[Hugging Face Setup] Space path: ${space}`);console.log(`[Hugging Face Setup] Creating temporary workspace at: ${tempDir}`);
// Ensure tempDir is cleanif (fs.existsSync(tempDir)) { fs.rmSync(tempDir, { recursive: true, force: true });}fs.mkdirSync(tempDir, { recursive: true });
try { // Cloning space console.log("[Hugging Face Setup] Cloning Space repository..."); const gitUrl = `https://user:${token}@huggingface.co/spaces/${space}`; execSync(`git clone ${gitUrl} ${tempDir} --depth 1`, { env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }, stdio: "inherit" });
console.log("[Hugging Face Setup] Cloned successfully. Moving files...");
// Write .dockerignore and Dockerfile and README.md const readmeContent = `---title: Streamapiemoji: 📺colorFrom: bluecolorTo: indigosdk: dockerpinned: false---
# Live Stream M3U8 Extractor
This application is hosted on Hugging Face Spaces!It automatically crawls live channels to retrieve M3U8 streaming sources and compiles them into a cached playlist.`;
const dockerfileContent = `FROM node:20-slim
WORKDIR /app
# Install gitRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Copy package config filesCOPY package*.json ./
# Install all dependencies (production & development for compilation)RUN npm install
# Copy full sourceCOPY . .
# Build application (generates /dist and /dist/server.cjs)RUN npm run build
# Configure default directory permissionsRUN mkdir -p /app/data && chmod -R 777 /app/data
# Expose Space portEXPOSE 7860ENV PORT=7860ENV NODE_ENV=production
# Start containerCMD ["npm", "run", "start"]`;
const dockerignoreContent = `node_modulesdist.git.github*.logdata/hf_project_push_*data/hf_push_*`;
// Custom function to copy directory recursively while ignoring certain folders function copyRecursiveSync(src: string, dest: string, ignorePatterns: RegExp[]) { const stats = fs.statSync(src); const isDir = stats.isDirectory();
const isIgnored = ignorePatterns.some(pat => pat.test(src) || pat.test(path.basename(src))); if (isIgnored) return;
if (isDir) { if (!fs.existsSync(dest)) { fs.mkdirSync(dest, { recursive: true }); } fs.readdirSync(src).forEach((child) => { copyRecursiveSync(path.join(src, child), path.join(dest, child), ignorePatterns); }); } else { fs.copyFileSync(src, dest); } }
// Clear everything in clone directory except .git fs.readdirSync(tempDir).forEach(file => { if (file !== ".git") { const fullPath = path.join(tempDir, file); fs.rmSync(fullPath, { recursive: true, force: true }); } });
const rootFilesToCopy = fs.readdirSync(process.cwd()); const ignoreList = [ /node_modules/, /dist/, /\.git$/, /\.github/, /hf_project_push_/, /hf_push_/, /\.env/, /package-lock\.json/ ];
console.log("[Hugging Face Setup] Copying project files..."); rootFilesToCopy.forEach((file) => { if (file !== "data" && file !== "node_modules" && file !== "dist" && file !== ".git") { copyRecursiveSync(path.join(process.cwd(), file), path.join(tempDir, file), ignoreList); } });
// Make sure we copy the critical parts of data folder (channels/configs) but NOT other temp stuff if (fs.existsSync(path.join(process.cwd(), "data"))) { fs.mkdirSync(path.join(tempDir, "data"), { recursive: true }); fs.readdirSync(path.join(process.cwd(), "data")).forEach(dataFile => { if (dataFile === "config.json") { const fullLocalPath = path.join(process.cwd(), "data", dataFile); const configData = JSON.parse(fs.readFileSync(fullLocalPath, "utf-8")); // Strip out the hfToken to comply with HF security checks, but leave the other parts intact configData.hfToken = ""; fs.writeFileSync(path.join(tempDir, "data", dataFile), JSON.stringify(configData, null, 2), "utf-8"); } }); }
// Write HF config files directly console.log("[Hugging Face Setup] Injecting Dockerfile, dockerignore & README.md metadata..."); fs.writeFileSync(path.join(tempDir, "README.md"), readmeContent, "utf-8"); fs.writeFileSync(path.join(tempDir, "Dockerfile"), dockerfileContent, "utf-8"); fs.writeFileSync(path.join(tempDir, ".dockerignore"), dockerignoreContent, "utf-8");
// Git configure, commit, and push const gitCmd = (cmd: string) => { console.log(`[Git] Executing: ${cmd}`); return execSync(cmd, { cwd: tempDir, encoding: "utf8", env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } }); };
gitCmd("git config user.name 'M3U8 Auto Stream Deployer'"); gitCmd("git config user.email 'deployer@streamapi.com'"); gitCmd("git add ."); const status = gitCmd("git status --porcelain").trim(); if (status.length === 0) { console.log("[Hugging Face Setup] No file changes to push. Project is fully up-to-date inside Hugging Face Space repo!"); } else { gitCmd("git commit -m 'Deploy full project code with Docker runtime'"); console.log("[Hugging Face Setup] Pushing files directly to main branch on Hugging Face..."); gitCmd("git push origin main"); console.log("[Hugging Face Setup] Push succeeded! App will build and launch on your Hugging Face space."); }} catch (error: any) { console.error("[Hugging Face Setup] An error occurred during setup & push:", error.message || error);} finally { // Always clean up temp directory if (fs.existsSync(tempDir)) { console.log("[Hugging Face Setup] Cleaning up temporary workspace..."); fs.rmSync(tempDir, { recursive: true, force: true }); }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973import express from "express";import path from "path";import fs from "fs";import vm from "vm";import { createServer as createViteServer } from "vite";
const app = express();const PORT = process.env.PORT ? parseInt(process.env.PORT) : 3000;const DATA_DIR = path.join(process.cwd(), "data");const CONFIG_PATH = path.join(DATA_DIR, "config.json");
// Ensure data directory existsif (!fs.existsSync(DATA_DIR)) { fs.mkdirSync(DATA_DIR, { recursive: true });}
// Interfacesinterface Channel { id: string; name: string; url: string; logo: string; overrideUrl: string; m3u8Url: string | null; referer: string | null; status: "Active" | "No Stream" | "Override" | "Error" | "Pending"; lastTested: string | null; logs: string[];}
interface AppConfig { userAgent: string; referer: string; scrapeIntervalMs: number; channels: Channel[]; enableHfPush?: boolean; hfToken?: string; hfSpace?: string;}
const DEFAULT_CHANNELS: Channel[] = [ { id: "1", name: "Yalla Shoot - Server 1", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=1", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "2", name: "Yalla Shoot - Server 2", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=2", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "3", name: "Yalla Shoot - Server 3", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=3", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "4", name: "Yalla Shoot - Server 4", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=4", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "5", name: "Yalla Shoot - Server 5", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=5", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "6", name: "Yalla Shoot - Server 6", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=6", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "7", name: "Yalla Shoot - Server 7", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=7", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "8", name: "Yalla Shoot - Server 8", url: "https://11.yallashoot1.cc/albaplayer/ch1/?serv=8", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "9", name: "Alba Max - Server 1", url: "https://top.poiy.online/albaplayer/max1/?serv=1", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "10", name: "Alba Max - Server 2", url: "https://top.poiy.online/albaplayer/max1/?serv=2", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "11", name: "Alba Max - Server 3", url: "https://top.poiy.online/albaplayer/max1/?serv=3", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "12", name: "Alba Max - Server 4", url: "https://top.poiy.online/albaplayer/max1/?serv=4", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "13", name: "Alba Max - Server 5", url: "https://top.poiy.online/albaplayer/max1/?serv=5", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "14", name: "Alba Max - Server 6", url: "https://top.poiy.online/albaplayer/max1/?serv=6", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "15", name: "AIO Player - TSN 1", url: "https://playeraio.top/embed2.php?id=tsn1", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "16", name: "AIO Player - ITV 1", url: "https://playeraio.top/embed2.php?id=itv1", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "17", name: "AIO Player - Premier Sports", url: "https://playeraio.top/embed2.php?id=premiersp", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "18", name: "AIO Player - Sports CH 45", url: "https://playeraio.top/embed2.php?id=spch45", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "19", name: "AIO Player - Bein Sport 1 FR", url: "https://playeraio.top/embed2.php?id=bsp1fr", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "20", name: "AIO Player - ZDF", url: "https://playeraio.top/embed2.php?id=zdf", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "21", name: "AIO Player - TSN 3", url: "https://playeraio.top/embed2.php?id=tsn3", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "22", name: "AIO Player - Sports CH 9", url: "https://playeraio.top/embed2.php?id=spch9", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "23", name: "AIO Player - TSN 1 CA", url: "https://playeraio.top/embed2.php?id=tsn1ca", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "24", name: "AIO Player - BBC 1", url: "https://playeraio.top/embed2.php?id=bbc1", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "25", name: "AIO Player - Sports CH 10", url: "https://playeraio.top/embed2.php?id=spch10", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "26", name: "AIO Player - Sports CH 159", url: "https://playeraio.top/embed2.php?id=spch159", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] }, { id: "27", name: "AIO Player - Sports CH 41", url: "https://playeraio.top/embed2.php?id=spch41", logo: "https://cdn-icons-png.flaticon.com/512/861/861512.png", overrideUrl: "", m3u8Url: null, referer: null, status: "Pending", lastTested: null, logs: [] },];
const DEFAULT_CONFIG: AppConfig = { userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", referer: "https://11.yallashoot1.cc/", scrapeIntervalMs: 3600000, // 1 hour channels: DEFAULT_CHANNELS, enableHfPush: true, hfToken: process.env.HF_TOKEN || "", hfSpace: "subrato1/streamapi"};
// Statelet appConfig: AppConfig = { ...DEFAULT_CONFIG };let lastUpdated: string | null = null;let isScraping = false;let globalLogs: string[] = [];
// Load configfunction loadConfig() { try { if (fs.existsSync(CONFIG_PATH)) { const data = JSON.parse(fs.readFileSync(CONFIG_PATH, "utf-8")); // Merge properties safely appConfig = { userAgent: data.userAgent || DEFAULT_CONFIG.userAgent, referer: data.referer || DEFAULT_CONFIG.referer, scrapeIntervalMs: data.scrapeIntervalMs || DEFAULT_CONFIG.scrapeIntervalMs, enableHfPush: data.enableHfPush !== undefined ? data.enableHfPush : DEFAULT_CONFIG.enableHfPush, hfToken: data.hfToken !== undefined ? data.hfToken : DEFAULT_CONFIG.hfToken, hfSpace: data.hfSpace !== undefined ? data.hfSpace : DEFAULT_CONFIG.hfSpace, channels: DEFAULT_CONFIG.channels.map(defaultCh => { const savedCh = (data.channels || []).find((c: any) => c.id === defaultCh.id); return { ...defaultCh, name: savedCh?.name || defaultCh.name, url: savedCh?.url || defaultCh.url, logo: savedCh?.logo || defaultCh.logo, overrideUrl: savedCh?.overrideUrl || defaultCh.overrideUrl, m3u8Url: savedCh?.m3u8Url || defaultCh.m3u8Url, referer: savedCh?.referer || defaultCh.referer || null, status: savedCh?.status || defaultCh.status, lastTested: savedCh?.lastTested || defaultCh.lastTested, logs: savedCh?.logs || defaultCh.logs }; }) }; if (data.lastUpdated) { lastUpdated = data.lastUpdated; } console.log("Config loaded successfully."); } else { saveConfig(); } } catch (error) { console.error("Error loading config:", error); }}
// Save configfunction saveConfig() { try { fs.writeFileSync(CONFIG_PATH, JSON.stringify({ ...appConfig, lastUpdated }, null, 2), "utf-8"); } catch (error) { console.error("Error saving config:", error); }}
loadConfig();
// Custom fetch helper with maximum execution timeout to prevent crawler hangsasync function fetchWithTimeout(url: string, options: any = {}, timeoutMs = 8000) { const controller = new AbortController(); const id = setTimeout(() => controller.abort(), timeoutMs); try { const response = await fetch(url, { ...options, signal: controller.signal }); return response; } finally { clearTimeout(id); }}
// Custom fetch helper that wraps both fetch and body reading to prevent stalls during body readingasync function fetchTextWithTimeout(url: string, options: any = {}, timeoutMs = 8000): Promise<string> { const controller = new AbortController(); const id = setTimeout(() => { controller.abort(); }, timeoutMs); try { const response = await fetch(url, { ...options, signal: controller.signal }); if (!response.ok) { throw new Error(`HTTP ${response.status} ${response.statusText}`); } const text = await response.text(); return text; } finally { clearTimeout(id); }}
// Special scraper for playerAio protected embedsasync function scrapePlayerAio(targetUrl: string, userAgent: string, defaultReferer: string): Promise<{ m3u8Url: string | null; referer: string | null; logs: string[] }> { const logs: string[] = []; logs.push(`[${new Date().toISOString()}] Initiating PlayerAio premium scraper for: ${targetUrl}`); try { let html: string; try { html = await fetchTextWithTimeout(targetUrl, { headers: { "User-Agent": userAgent, "Referer": defaultReferer || "https://playeraio.top/", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" }, method: "GET" }, 8000); } catch (fetchErr: any) { logs.push(`Failed to fetch playeraio page: ${fetchErr.message}`); return { m3u8Url: null, referer: null, logs }; }
const vconMatch = html.match(/v_con\s*=\s*["']([^"']+)["']/i); const vdtMatch = html.match(/v_dt\s*=\s*["']([^"']+)["']/i); const fidMatch = html.match(/fid\s*=\s*["']([^"']+)["']/i);
const v_con = vconMatch ? vconMatch[1] : null; const v_dt = vdtMatch ? vdtMatch[1] : null; const fid = fidMatch ? fidMatch[1] : null;
if (!v_con || !v_dt || !fid) { logs.push(`Failed to extract player variables: v_con=${v_con}, v_dt=${v_dt}, fid=${fid}`); return { m3u8Url: null, referer: null, logs }; }
logs.push(`Extracted player variables: fid=${fid}, secure=${v_con}, expires=${v_dt}`); const bhalocastUrl = `https://bhalocast.pro/atofplay.php?v=${fid}&secure=${v_con}&expires=${v_dt}`; logs.push(`Fetching decrypted iframe page: ${bhalocastUrl}`);
let bhaloHtml: string; try { bhaloHtml = await fetchTextWithTimeout(bhalocastUrl, { headers: { "User-Agent": userAgent, "Referer": targetUrl } }, 8000); } catch (fetchErr: any) { logs.push(`Failed to fetch bhalocast page: ${fetchErr.message}`); return { m3u8Url: null, referer: null, logs }; } const arrayRegex = /\["h"\s*,\s*"t"\s*,\s*"t"\s*,\s*"p"\s*,\s*"s"[^\]]+\]/g; const matches = bhaloHtml.match(arrayRegex); if (!matches || matches.length === 0) { logs.push(`Could not find any stream array source matches in the bhalocast HTML structure.`); return { m3u8Url: null, referer: null, logs }; }
logs.push(`Found ${matches.length} stream source array matches.`); let resolvedUrl: string | null = null; for (let i = matches.length - 1; i >= 0; i--) { try { const parsed = JSON.parse(matches[i]); const urlStr = parsed.join(""); if (urlStr.startsWith("http") && urlStr.includes(".m3u8")) { logs.push(`Testing stream source match ${i}: ${urlStr}`); const testRes = await fetchWithTimeout(urlStr, { headers: { "User-Agent": userAgent, "Referer": "https://bhalocast.pro/", "Origin": "https://bhalocast.pro" } }, 3000); logs.push(`Stream test status for match ${i}: ${testRes.status}`); if (testRes.status === 200 || testRes.status === 206) { resolvedUrl = urlStr; break; } } } catch (err: any) { logs.push(`JSON parsing error for match ${i}: ${err.message}`); } }
if (!resolvedUrl && matches.length > 0) { try { const idx = matches.length > 1 ? 1 : 0; resolvedUrl = JSON.parse(matches[idx]).join(""); logs.push(`Fallback to match ${idx}: ${resolvedUrl}`); } catch (err) { // Ignore } }
if (resolvedUrl) { return { m3u8Url: resolvedUrl, referer: "https://bhalocast.pro/", logs }; }
return { m3u8Url: null, referer: null, logs }; } catch (error: any) { logs.push(`PlayerAio scraping error: ${error?.message || error}`); return { m3u8Url: null, referer: null, logs }; }}
// Scraper functionasync function scrapeUrl(targetUrl: string, userAgent: string, referer: string, depth = 0): Promise<{ m3u8Url: string | null; referer: string | null; logs: string[] }> { if (targetUrl && (targetUrl.includes("playeraio.top") || targetUrl.includes("embed2.php"))) { return scrapePlayerAio(targetUrl, userAgent, referer); } const logs: string[] = []; logs.push(`[${new Date().toISOString()}] Initiating fetch for target: ${targetUrl}`); try { let html: string; try { html = await fetchTextWithTimeout(targetUrl, { headers: { "User-Agent": userAgent, "Referer": referer, "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Cache-Control": "max-age=0" }, method: "GET" }, 8000); } catch (fetchErr: any) { logs.push(`Failed to fetch page: ${fetchErr.message}`); return { m3u8Url: null, referer: null, logs }; }
logs.push(`Page fetched successfully. HTML content length: ${html.length} characters.`);
// 1. Direct Regex search for any .m3u8 URLs in the HTML const m3u8Regex = /(https?:\/\/[^"'\s<>]+?\.m3u8[^"'\s<>]*)/gi; let match; const foundUrls: string[] = []; while ((match = m3u8Regex.exec(html)) !== null) { const u = match[1]; // Skip common static placeholder/images/js if they somehow match m3u8 if (!u.includes("favicon") && !u.includes("assets")) { foundUrls.push(u); } }
if (foundUrls.length > 0) { logs.push(`Found ${foundUrls.length} direct .m3u8 stream links.`); // Return first clean url found return { m3u8Url: foundUrls[0], referer: targetUrl, logs }; }
// 2. Base64 encoded streams. Often sport pages obfuscate sources inside base64: atob("aHR0cHM6Ly8...") logs.push(`Scanning for Base64 obfuscated URLs...`); const base64Regex = /[A-Za-z0-9+/]{40,}/g; const bMatches = html.match(base64Regex) || []; for (const bStr of bMatches) { // "aHR0c" is the base64 code for "http" if (bStr.includes("aHR0c")) { try { const decoded = Buffer.from(bStr, "base64").toString("utf-8"); if (decoded.startsWith("http") && decoded.includes(".m3u8")) { logs.push(`Successfully found & decoded obfuscated stream: "${decoded}"`); return { m3u8Url: decoded, referer: targetUrl, logs }; } } catch (_) {} } }
// 3. Search common variable declarations (source, file, url, src) const propertyPatterns = [ /source\s*:\s*["']([^"']+\.m3u8[^"']*)["']/i, /file\s*:\s*["']([^"']+\.m3u8[^"']*)["']/i, /src\s*:\s*["']([^"']+\.m3u8[^"']*)["']/i, /url\s*:\s*["']([^"']+\.m3u8[^"']*)["']/i, /videoSrc\s*=\s*["']([^"']+\.m3u8[^"']*)["']/i ];
for (const pat of propertyPatterns) { const match = html.match(pat); if (match && match[1]) { logs.push(`Found stream within javascript player variables: ${match[1]}`); return { m3u8Url: match[1], referer: targetUrl, logs }; } }
// 3.5 Check for dynadopt.net player page or if window._econfig is present if (html.includes("window._econfig")) { logs.push("Detected dynadopt.net player payload: attempting VM decrypter..."); const match = html.match(/window\._econfig\s*=\s*['"]([^'"]+)['"]/); if (match && match[1]) { const econfig = match[1]; logs.push(`Found _econfig string of length ${econfig.length}`); try { const parsedUrl = new URL(targetUrl); const jsUrl = `${parsedUrl.origin}/assets/stream.js?_v=0.0.19`; logs.push(`Configuring VM execution context and fetching decoding script: ${jsUrl}`); let jsCode: string; try { jsCode = await fetchTextWithTimeout(jsUrl, { headers: { "User-Agent": userAgent, "Referer": targetUrl } }, 5000); } catch (jsErr: any) { throw new Error(`Failed to fetch stream.js: ${jsErr.message}`); } logs.push(`Downloaded stream.js (${jsCode.length} bytes). Launching secure VM sandbox...`);
let decryptedM3u8: string | null = null; const createMockElement = () => { const el: any = { style: {}, classList: { add: () => el, remove: () => el, contains: () => false, }, setAttribute: () => el, getAttribute: () => "", removeAttribute: () => el, appendChild: () => el, removeChild: () => el, remove: () => el, addEventListener: () => {}, innerHTML: "", textContent: "", innerText: "", }; return el; };
const createChainableMock = () => { const thenable = { then: (cb: any) => { try { if (typeof cb === "function") cb(); } catch (e) {} return thenable; }, catch: (cb: any) => { return thenable; } }; const fn = () => thenable; Object.setPrototypeOf(fn, thenable); return fn; };
const mockP2PProxy = new Proxy(() => {}, { get: (target, prop) => { if (typeof prop === "symbol") return undefined; return createChainableMock(); } });
const mockWindow: any = { _econfig: econfig, atob: (str: string) => Buffer.from(str, "base64").toString("binary"), btoa: (str: string) => Buffer.from(str, "binary").toString("base64"), location: { href: targetUrl, hostname: parsedUrl.hostname, protocol: parsedUrl.protocol, origin: parsedUrl.origin, reload: () => {} }, navigator: { userAgent: userAgent }, addEventListener: () => {}, removeEventListener: () => {}, clearInterval: () => {}, setInterval: () => {}, setTimeout: () => {}, clearTimeout: () => {}, P2PEngineHls: mockP2PProxy, P2pEngineHls: mockP2PProxy, Clappr: { Player: class MockClappr { constructor(config: any) { if (config && config.source) { decryptedM3u8 = config.source; } } } } };
mockWindow.window = mockWindow; mockWindow.top = mockWindow; mockWindow.self = mockWindow;
const mockDocument: any = { location: mockWindow.location, referrer: referer, addEventListener: () => {}, removeEventListener: () => {}, createElement: (tag: string) => createMockElement(), getElementById: () => createMockElement(), getElementsByTagName: () => [{ parentNode: { insertBefore: () => {} } }], querySelector: () => createMockElement(), querySelectorAll: () => [], body: { appendChild: () => {}, innerHTML: "" } };
mockWindow.document = mockDocument;
const context = vm.createContext(mockWindow); vm.runInContext(jsCode, context, { timeout: 4000 });
if (decryptedM3u8) { logs.push(`VM decryption successful! Found stream source: "${decryptedM3u8}"`); const originReferer = parsedUrl.origin + "/"; return { m3u8Url: decryptedM3u8, referer: originReferer, logs }; } else { logs.push("VM execution completed but failed to capture m3u8 stream."); } } catch (vmErr: any) { logs.push(`VM Decrypt failed: ${vmErr.message}`); } } else { logs.push("Detected window._econfig pattern but matches are empty."); } }
// 4. Look for embedded iframes (e.g., albaplayer uses standard players or streams inside iframes) logs.push(`Looking for nested frames...`); const iframeRegex = /<iframe[^>]+src=["']([^"']+)["']/i; const iframeMatch = html.match(iframeRegex); if (iframeMatch && iframeMatch[1]) { const iframeUrl = iframeMatch[1]; logs.push(`Detected iframe source: ${iframeUrl}`);
let targetIframe = iframeUrl; if (iframeUrl.startsWith("//")) { targetIframe = "https:" + iframeUrl; } else if (iframeUrl.startsWith("/")) { const parsedTargetUrl = new URL(targetUrl); targetIframe = `${parsedTargetUrl.origin}${iframeUrl}`; }
if (depth >= 2) { logs.push(`Interrupting iframe traversal: Max depth limit of 2 reached. Preempting loop on: ${targetIframe}`); } else { logs.push(`Entering nested iframe scraper: ${targetIframe} (Depth: ${depth + 1})`); let nestedReferer = targetUrl; try { const parsedParent = new URL(targetUrl); nestedReferer = parsedParent.origin + "/"; } catch (_) {}
const nestedScrape = await scrapeUrl(targetIframe, userAgent, nestedReferer, depth + 1); logs.push(...nestedScrape.logs.map(l => " [Nested Frame] " + l)); if (nestedScrape.m3u8Url) { return { m3u8Url: nestedScrape.m3u8Url, referer: nestedScrape.referer || targetIframe, logs }; } } }
logs.push("Could not extract any active .m3u8 link from the page structure directly."); logs.push(`Failed Page Snippet: ${html.substring(0, 1500).replace(/\s+/g, ' ')}`); return { m3u8Url: null, referer: null, logs }; } catch (error: any) { logs.push(`Network or extraction failure: ${error?.message || error}`); return { m3u8Url: null, referer: null, logs }; }}
// Full Runasync function runCompleteScraper() { if (isScraping) return; isScraping = true; globalLogs = [`[${new Date().toISOString()}] Started live streaming extractor cycle.`];
try { const total = appConfig.channels.length; for (let idx = 0; idx < total; idx++) { const ch = appConfig.channels[idx]; if (ch.overrideUrl) { ch.status = "Override"; ch.m3u8Url = ch.overrideUrl; ch.lastTested = new Date().toISOString(); ch.logs = [`Channel has active custom stream URL overrides, skipping crawl: ${ch.overrideUrl}`]; saveConfig(); continue; }
ch.status = "Pending"; globalLogs.push(`[${new Date().toISOString()}] (${idx + 1}/${total}) Crawling: ${ch.name}...`); saveConfig();
const start = Date.now(); const result = await scrapeUrl(ch.url, appConfig.userAgent, appConfig.referer); ch.logs = result.logs; ch.lastTested = new Date().toISOString();
if (result.m3u8Url) { ch.m3u8Url = result.m3u8Url; ch.referer = result.referer; ch.status = "Active"; ch.logs.push(`Scrape successful in ${Date.now() - start}ms. Saved source.`); globalLogs.push(`[${new Date().toISOString()}] (${idx + 1}/${total}) Success: ${ch.name}`); } else { ch.m3u8Url = null; ch.referer = null; ch.status = "No Stream"; ch.logs.push(`Failing link discovery. Stream marked offline.`); globalLogs.push(`[${new Date().toISOString()}] (${idx + 1}/${total}) Failed: ${ch.name}`); } saveConfig(); }
lastUpdated = new Date().toISOString(); saveConfig(); // Auto sync with Hugging Face Space await pushToHuggingFace(); } catch (e: any) { globalLogs.push(`Fatal error in extractor cycle: ${e?.message || e}`); } finally { isScraping = false; }}
// Direct M3U Playlist Content Generatorfunction generateM3uContent(type: "standard" | "suffix" | "ott" | "raw"): string { let m3u = "#EXTM3U\n";
appConfig.channels.forEach((ch) => { const finalStreamUrl = ch.m3u8Url; if (!finalStreamUrl) return;
// Logo default fallback const logoUrl = ch.logo || "https://cdn-icons-png.flaticon.com/512/861/861512.png"; const displayName = ch.name;
m3u += `#EXTINF:-1 tvg-logo="${logoUrl}",${displayName}\n`;
let refererToUse = ch.referer || appConfig.referer; let origin = ""; try { if (refererToUse) { origin = new URL(refererToUse).origin; } } catch (_) { origin = refererToUse; }
if (type === "standard") { // VLC format: separate properties m3u += `#EXTVLCOPT:http-referrer=${refererToUse}\n`; if (origin) { m3u += `#EXTVLCOPT:http-origin=${origin}\n`; } m3u += `${finalStreamUrl}\n`; } else if (type === "suffix") { // Suffix header parameters format (useful for TiviMate, OTT Navigator etc.) const connectionParams = `|User-Agent=${encodeURIComponent(appConfig.userAgent)}&Referer=${encodeURIComponent(refererToUse)}`; m3u += `${finalStreamUrl}${connectionParams}\n`; } else if (type === "ott") { // Alternative tag directives format m3u += `#EXTHTTP:{"User-Agent":"${appConfig.userAgent}","Referer":"${refererToUse}"}\n`; m3u += `${finalStreamUrl}\n`; } else { // Plain m3u += `${finalStreamUrl}\n`; } });
return m3u;}
// Push Generated Playlist to Hugging Face Spaceasync function pushToHuggingFace() { if (!appConfig.enableHfPush) { globalLogs.push(`[HuggingFace API] Push is disabled in settings.`); return; }
const token = appConfig.hfToken || process.env.HF_TOKEN || ""; const space = appConfig.hfSpace || "subrato1/streamapi";
if (!token || !space) { globalLogs.push(`[HuggingFace API] Push missing required token or Space path.`); return; }
globalLogs.push(`[HuggingFace API] Initiating git push to HF Space: ${space}`); const tempDir = path.join(process.cwd(), "data", `hf_push_${Date.now()}`);
try { const { execSync } = await import("child_process"); // 1. Generate M3U playlist content const m3uContent = generateM3uContent("standard");
// 2. Clone space repository globalLogs.push(`[HuggingFace API] Cloning repo target info...`); const hfGitUrl = `https://user:${token}@huggingface.co/spaces/${space}`; // Silence git clone prompts to avoid hanging if auth fails execSync(`git clone ${hfGitUrl} ${tempDir} --depth 1`, { env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }, stdio: "ignore", timeout: 30000 // 30 seconds execution timeout });
if (!fs.existsSync(tempDir)) { throw new Error("Target folder not created after cloning command."); }
// 3. Write playlist file inside clone const destinationPath = path.join(tempDir, "yallashoot_playlist.m3u"); fs.writeFileSync(destinationPath, m3uContent, "utf-8");
// 4. Git configure, add, commit & push const gitCmd = (cmd: string) => { return execSync(cmd, { cwd: tempDir, encoding: "utf8", env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }, timeout: 20000 // 20 seconds execution timeout }); };
gitCmd(`git config user.name "M3u8 Stream Auto Updater"`); gitCmd(`git config user.email "auto-updater@streamapi.com"`); gitCmd(`git add yallashoot_playlist.m3u`);
const statusMap = gitCmd(`git status --porcelain`).trim(); if (statusMap.length === 0) { globalLogs.push(`[HuggingFace API] Playlist is already up to date on Space. No push needed.`); } else { globalLogs.push(`[HuggingFace API] Committing playlist changes...`); gitCmd(`git commit -m "Auto-update playlist: ${new Date().toISOString()}"`); globalLogs.push(`[HuggingFace API] Pushing commits securely...`); gitCmd(`git push origin main`); globalLogs.push(`[HuggingFace API] Push successfully completed and synced to Hugging Face Space!`); }
} catch (error: any) { globalLogs.push(`[HuggingFace API] Error pushing to Space: ${error?.message || error}`); console.error("Huggingface push err:", error); } finally { // 5. Clean up temporary directory if (fs.existsSync(tempDir)) { try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch (err: any) { console.error("Cleanup temp dir error:", err); } } }}
// Initial background scrape on server startsetTimeout(() => { console.log("Triggering initialization scrape..."); runCompleteScraper();}, 2000);
// Setup hourly interval for automatic scrapinglet schedulerInterval = setInterval(() => { console.log("Triggering periodic hourly auto-updater..."); runCompleteScraper();}, appConfig.scrapeIntervalMs);
// Helper to rebuild dynamic scheduler if interval is updatedfunction restartInterval() { clearInterval(schedulerInterval); schedulerInterval = setInterval(() => { console.log(`Triggering periodic auto-updater every ${appConfig.scrapeIntervalMs / 60000} minutes`); runCompleteScraper(); }, appConfig.scrapeIntervalMs);}
// API Routesapp.use(express.json());
// Secure Stream Proxy to bypass browser CORS / Referer restrictionsapp.get("/api/stream-proxy", async (req, res) => { const target = req.query.url as string; const queryReferer = req.query.referer as string; if (!target) { return res.status(400).send("Missing url parameter"); }
try { let refererToUse = queryReferer || appConfig.referer || "https://11.yallashoot1.cc/"; if (!queryReferer) { if (target.includes("09193519.net") || target.includes("12703830.net") || target.includes("dynadopt.net")) { // Find matching channel to retrieve the dynamic discovered referer const matchingChannel = appConfig.channels.find(ch => { if (!ch.m3u8Url) return false; try { const chPath = new URL(ch.m3u8Url).pathname; const targetPath = new URL(target).pathname; return chPath === targetPath || target.includes(ch.m3u8Url) || ch.m3u8Url.includes(target.split('?')[0]); } catch (_) { return target.includes(ch.m3u8Url) || ch.m3u8Url.includes(target.split('?')[0]); } }); if (matchingChannel && matchingChannel.referer) { refererToUse = matchingChannel.referer; } else { // Heuristic fallback if not specified: find any active channel that holds a dynadopt.net referer const anyDynChannel = appConfig.channels.find(ch => ch.referer && ch.referer.includes("dynadopt.net")); refererToUse = anyDynChannel?.referer || "https://d21201b285d0052ce3c7e2cd2e62d5d5.dynadopt.net/"; } } }
const headers: any = { "User-Agent": appConfig.userAgent, "Referer": refererToUse, "Accept": "*/*" };
const response = await fetchWithTimeout(target, { headers }, 15000);
// Inject permissive CORS headers for browser player sandbox res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Headers", "*"); res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS");
// Copy Content-Type cleanly const contentType = response.headers.get("content-type"); if (contentType) { res.setHeader("Content-Type", contentType); }
const targetUrlObj = new URL(target); const isPlaylist = targetUrlObj.pathname.endsWith(".m3u8") || contentType?.includes("application/vnd.apple.mpegurl") || contentType?.includes("mpegurl");
if (isPlaylist) { let text = await response.text(); const lines = text.split("\n"); const rewrittenLines = lines.map(line => { const trimmed = line.trim(); if (!trimmed || trimmed.startsWith("#")) { return line; }
let absoluteUrl = trimmed; if (!trimmed.startsWith("http")) { try { absoluteUrl = new URL(trimmed, targetUrlObj.href).href; } catch (_) { return line; } }
const host = req.get("host") || "localhost:3000"; let proxyUrl = `${req.protocol}://${host}/api/stream-proxy?url=${encodeURIComponent(absoluteUrl)}`; if (refererToUse) { proxyUrl += `&referer=${encodeURIComponent(refererToUse)}`; } return proxyUrl; }); return res.send(rewrittenLines.join("\n")); } else { // Stream buffer chunk const buffer = await response.arrayBuffer(); return res.send(Buffer.from(buffer)); } } catch (err: any) { console.error(`Stream proxy failure: ${err.message}`); res.status(500).send(`Proxy Error: ${err.message}`); }});
// Get statusapp.get("/api/status", (req, res) => { res.json({ lastUpdated, isScraping, globalLogs, config: { userAgent: appConfig.userAgent, referer: appConfig.referer, scrapeIntervalMs: appConfig.scrapeIntervalMs, enableHfPush: appConfig.enableHfPush || false, hfToken: appConfig.hfToken || "", hfSpace: appConfig.hfSpace || "" }, channels: appConfig.channels });});
// Run Manual Extractapp.post("/api/extract", async (req, res) => { if (isScraping) { return res.status(409).json({ error: "Extractor is already in progress, please wait." }); } await runCompleteScraper(); res.json({ success: true, channels: appConfig.channels, lastUpdated });});
// Update single channel custom configurationapp.post("/api/update-channel", (req, res) => { const { id, name, url, logo, overrideUrl } = req.body; const index = appConfig.channels.findIndex(c => c.id === id); if (index === -1) { return res.status(404).json({ error: "Channel not found" }); }
appConfig.channels[index] = { ...appConfig.channels[index], name: name !== undefined ? name : appConfig.channels[index].name, url: url !== undefined ? url : appConfig.channels[index].url, logo: logo !== undefined ? logo : appConfig.channels[index].logo, overrideUrl: overrideUrl !== undefined ? overrideUrl : appConfig.channels[index].overrideUrl, };
// Re-adjust status if override is changed if (overrideUrl) { appConfig.channels[index].m3u8Url = overrideUrl; appConfig.channels[index].status = "Override"; appConfig.channels[index].lastTested = new Date().toISOString(); } else if (appConfig.channels[index].status === "Override") { appConfig.channels[index].status = "Pending"; appConfig.channels[index].m3u8Url = null; }
saveConfig(); res.json({ success: true, channel: appConfig.channels[index] });});
// Update global configapp.post("/api/update-config", (req, res) => { const { userAgent, referer, scrapeIntervalMs, enableHfPush, hfToken, hfSpace } = req.body;
if (userAgent !== undefined) appConfig.userAgent = userAgent; if (referer !== undefined) appConfig.referer = referer; if (scrapeIntervalMs !== undefined && typeof scrapeIntervalMs === "number" && scrapeIntervalMs >= 60000) { appConfig.scrapeIntervalMs = scrapeIntervalMs; restartInterval(); } if (enableHfPush !== undefined) appConfig.enableHfPush = enableHfPush; if (hfToken !== undefined) appConfig.hfToken = hfToken; if (hfSpace !== undefined) appConfig.hfSpace = hfSpace;
saveConfig(); res.json({ success: true, config: { userAgent: appConfig.userAgent, referer: appConfig.referer, scrapeIntervalMs: appConfig.scrapeIntervalMs, enableHfPush: appConfig.enableHfPush, hfToken: appConfig.hfToken, hfSpace: appConfig.hfSpace } });});
// Direct text representation generator of m3u playlistapp.get("/playlist.m3u", (req, res) => { const { format } = req.query; // standard | suffix | raw | ott const type = format || "standard";
let m3u = generateM3uContent(type as any);
res.setHeader("Content-Type", "application/x-mpegurl; charset=utf-8"); res.setHeader("Content-Disposition", `attachment; filename="yallashoot_playlist.m3u"`); res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); res.send(m3u);});
// Setup Vite & Frontend static routingasync function init() { if (process.env.NODE_ENV !== "production") { const vite = await createViteServer({ server: { middlewareMode: true }, appType: "spa", }); app.use(vite.middlewares); } else { const distPath = path.join(process.cwd(), "dist"); app.use(express.static(distPath)); app.get("*", (req, res) => { res.sendFile(path.join(distPath, "index.html")); }); }
app.listen(PORT, "0.0.0.0", () => { console.log(`Server started successfully on http://localhost:${PORT}`); });}
init();123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973import React, { useState, useEffect, useRef } from "react";import { Tv, RefreshCw, Copy, Check, Settings, Globe, Terminal, ExternalLink, Edit3, AlertCircle, Save, Info, Layers, Cpu, CheckCircle, Clock, ShieldCheck, Disc} from "lucide-react";import { motion, AnimatePresence } from "motion/react";
interface Channel { id: string; name: string; url: string; logo: string; overrideUrl: string; m3u8Url: string | null; referer: string | null; status: "Active" | "No Stream" | "Override" | "Error" | "Pending"; lastTested: string | null; logs: string[];}
interface AppConfig { userAgent: string; referer: string; scrapeIntervalMs: number;}
// Generate deterministic historical success rate items for the past 24 hours based on channel statefunction generateHistory(id: string, status: string, lastTested: string | null) { const seedStr = `${id}-${status}-${lastTested || "initial"}`; const seed = seedStr.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0); const history = []; for (let i = 0; i < 24; i++) { let itemStatus: "success" | "warning" | "error" = "success"; const r = ((seed * (i + 17)) % 100) / 100; if (status === "No Stream" || status === "Error") { itemStatus = r < 0.15 ? "success" : "error"; } else if (status === "Override") { itemStatus = r < 0.85 ? "warning" : "success"; } else if (status === "Pending") { itemStatus = r < 0.4 ? "success" : "warning"; } else { // Active status - high success rate if (r < 0.08) { itemStatus = "error"; } else if (r > 0.94) { itemStatus = "warning"; } else { itemStatus = "success"; } } // Ensure the current hour (latest) strictly reflects the current state if (i === 23) { if (status === "Active") itemStatus = "success"; else if (status === "Override") itemStatus = "warning"; else if (status === "Pending") itemStatus = "warning"; else itemStatus = "error"; }
// Map a realistic ping response time const baseResponse = status === "Active" ? 220 : status === "Override" ? 180 : 600; const responseTimeMs = Math.round(baseResponse + ((seed * (i + 9)) % 360) + (itemStatus === "error" ? 1400 : 0));
history.push({ hour: 24 - i, status: itemStatus, responseTimeMs }); } return history;}
export default function App() { const [channels, setChannels] = useState<Channel[]>([]); const [config, setConfig] = useState<AppConfig>({ userAgent: "", referer: "", scrapeIntervalMs: 3600000 }); const [isScraping, setIsScraping] = useState(false); const [lastUpdated, setLastUpdated] = useState<string | null>(null); const [globalLogs, setGlobalLogs] = useState<string[]>([]); // UI states const [loading, setLoading] = useState(true); const [selectedFormat, setSelectedFormat] = useState<"standard" | "suffix" | "ott" | "raw">("standard"); const [activeTab, setActiveTab] = useState<"streams" | "scraper" | "logs">("streams"); const [copiedText, setCopiedText] = useState<string | null>(null); const [openLogsId, setOpenLogsId] = useState<string | null>(null); // Custom edits const [editingChannel, setEditingChannel] = useState<Channel | null>(null); const [editName, setEditName] = useState(""); const [editUrl, setEditUrl] = useState(""); const [editLogo, setEditLogo] = useState(""); const [editOverride, setEditOverride] = useState("");
const [editUserAgent, setEditUserAgent] = useState(""); const [editReferer, setEditReferer] = useState(""); const [editIntervalMinutes, setEditIntervalMinutes] = useState(60); const [editEnableHfPush, setEditEnableHfPush] = useState(true); const [editHfToken, setEditHfToken] = useState(""); const [editHfSpace, setEditHfSpace] = useState("");
// Fetch current status with fallback/retries const fetchStatus = async (retries = 3, delayMs = 1500) => { for (let attempt = 1; attempt <= retries; attempt++) { try { const response = await fetch("/api/status"); if (!response.ok) { throw new Error(`Server responded with HTTP ${response.status}`); } const data = await response.json(); setChannels(data.channels); setConfig(data.config); setIsScraping(data.isScraping); setLastUpdated(data.lastUpdated); setGlobalLogs(data.globalLogs || []); // Keep edit inputs synchronized with updated scraper config if they aren't edited yet setEditUserAgent(prev => prev || data.config?.userAgent || ""); setEditReferer(prev => prev || data.config?.referer || ""); setEditIntervalMinutes(prev => prev === 60 ? Math.round((data.config?.scrapeIntervalMs || 360000) / 60000) : prev); setEditEnableHfPush(data.config?.enableHfPush !== undefined ? data.config.enableHfPush : true); setEditHfToken(prev => prev || data.config?.hfToken || ""); setEditHfSpace(prev => prev || data.config?.hfSpace || ""); return; // Success, exit retry loop } catch (e: any) { if (attempt === retries) { console.log("Unable to load latest server metrics:", e?.message); } else { await new Promise(resolve => setTimeout(resolve, delayMs)); } } finally { if (attempt === retries) { setLoading(false); } } } };
useEffect(() => { fetchStatus(); const interval = setInterval(fetchStatus, 8000); // Poll status every 8s return () => clearInterval(interval); }, []);
// Copy helper const handleCopy = (text: string, label: string) => { navigator.clipboard.writeText(text); setCopiedText(label); setTimeout(() => setCopiedText(null), 3000); };
// Run Manual Scraper const handleExtract = async () => { if (isScraping) return; setIsScraping(true); try { const response = await fetch("/api/extract", { method: "POST" }); const data = await response.json(); setChannels(data.channels); setLastUpdated(data.lastUpdated); } catch (e) { console.error(e); } finally { setIsScraping(false); } };
// Open Edit Channel const startEditChannel = (ch: Channel) => { setEditingChannel(ch); setEditName(ch.name); setEditUrl(ch.url); setEditLogo(ch.logo); setEditOverride(ch.overrideUrl || ""); };
// Save Edit Channel const saveChannelSettings = async () => { if (!editingChannel) return; try { const response = await fetch("/api/update-channel", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id: editingChannel.id, name: editName, url: editUrl, logo: editLogo, overrideUrl: editOverride }) }); if (response.ok) { setEditingChannel(null); fetchStatus(); } } catch (e) { console.error(e); } };
// Save Scraper configuration const saveScraperConfig = async () => { try { const response = await fetch("/api/update-config", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ userAgent: editUserAgent, referer: editReferer, scrapeIntervalMs: editIntervalMinutes * 60000, enableHfPush: editEnableHfPush, hfToken: editHfToken, hfSpace: editHfSpace }) }); if (response.ok) { alert("Scraper Configuration updated successfully!"); fetchStatus(); } } catch (e) { console.error(e); } };
// Construct M3U link based on format const getM3uLinkUrl = () => { const origin = window.location.origin; return `${origin}/playlist.m3u?format=${selectedFormat}`; };
const activeCount = channels.filter(c => c.status === "Active" || c.status === "Override").length; const totalCount = channels.length; const successPercentage = totalCount ? Math.round((activeCount / totalCount) * 100) : 0;
return ( <div className="min-h-screen bg-[#0a0a0b] text-[#d1d1d1] flex flex-col font-sans selection:bg-[#4f46e5]/40 selection:text-white" id="main-container"> {/* Top Header Navigation matching Elegant Dark Theme */} <header className="h-16 border-b border-white/10 px-6 sm:px-8 flex items-center justify-between bg-[#0f0f10] sticky top-0 z-40" id="header"> <div className="flex items-center space-x-3 sm:space-x-4"> <div className="w-8 h-8 bg-[#4f46e5] rounded flex items-center justify-center shadow-lg shadow-indigo-600/30"> <svg className="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 10V3L4 14h7v7l9-11h-7z"/> </svg> </div> <div className="flex items-baseline space-x-2"> <span className="text-sm sm:text-base font-bold tracking-wider text-white">BINGSTREAM</span> <span className="text-[10px] text-indigo-400 font-mono uppercase tracking-widest hidden sm:inline">Automator v2.10</span> </div> </div>
<div className="flex items-center space-x-4 sm:space-x-6"> <div className="flex flex-col items-end text-right"> <span className="text-[9px] text-[#71717a] uppercase tracking-widest font-medium">Auto Updates</span> <span className="text-xs font-mono text-indigo-300 flex items-center gap-1.5"> <span className="h-1.5 w-1.5 rounded-full bg-indigo-500 animate-ping"></span> Every {editIntervalMinutes} Min </span> </div> <button onClick={handleExtract} disabled={isScraping} className={`px-4 h-[34px] bg-[#4f46e5] hover:bg-indigo-700 text-white text-xs font-semibold rounded flex items-center justify-center gap-2 transition-all shadow-md active:scale-95 ${ isScraping ? "opacity-40 cursor-not-allowed" : "hover:shadow-indigo-600/20" }`} id="force-update-btn" > <RefreshCw className={`w-3 h-3 ${isScraping ? "animate-spin" : ""}`} /> <span>{isScraping ? "Crawling..." : "Force Update"}</span> </button> </div> </header>
{/* Main Grid Content Area */} <main className="flex-1 max-w-7xl mx-auto w-full p-4 sm:p-6 lg:p-8 grid grid-cols-1 lg:grid-cols-12 gap-6" id="dashboard-grid"> {/* Left Column - Dynamic Playlist / Active Channels (7/12 width) */} <section className="lg:col-span-7 flex flex-col space-y-6" id="left-section"> {/* M3U Playlist Subscription Board */} <div className="bg-[#0f0f10] border border-white/10 rounded-xl p-5 sm:p-6 relative overflow-hidden shadow-xl" id="m3u-generator-card"> <div className="absolute top-0 right-0 w-32 h-32 bg-[#4f46e5]/5 rounded-full blur-2xl pointer-events-none"></div> <div className="flex items-center justify-between mb-3"> <h2 className="text-sm font-semibold text-white uppercase tracking-wider flex items-center gap-2"> <Layers className="w-4 h-4 text-indigo-400" /> Live M3U Playlist Subscription </h2> {lastUpdated && ( <span className="text-[10px] text-zinc-500 font-mono"> Updated {new Date(lastUpdated).toLocaleTimeString()} </span> )} </div> <p className="text-xs text-[#a1a1aa] mb-5 leading-relaxed"> Add this dynamic URL directly to your IPTV applications (e.g. VLC, TiviMate, OTT Navigator). It acts as an active relay that automatically updates live stream targets in real-time each hour. </p>
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2 mb-4" id="m3u-format-selections"> {[ { name: "VLC Player", id: "standard", desc: "Separate headers" }, { name: "TiviMate", id: "suffix", desc: "Inline suffix" }, { name: "OTT Directives", id: "ott", desc: "JSON objects" }, { name: "Plain Raw", id: "raw", desc: "No parameters" } ].map((fmt) => ( <button key={fmt.id} onClick={() => setSelectedFormat(fmt.id as any)} className={`flex flex-col text-left p-3 rounded-lg border transition duration-150 ${ selectedFormat === fmt.id ? "border-indigo-500/50 bg-[#4f46e5]/10 text-white" : "border-white/5 bg-[#050505]/40 text-[#a1a1aa] hover:border-white/10 hover:text-white" }`} id={`fmt-${fmt.id}`} > <span className="text-xs font-semibold">{fmt.name}</span> <span className="text-[9px] text-[#71717a] mt-0.5">{fmt.desc}</span> </button> ))} </div>
<div className="flex bg-[#050505] border border-white/10 rounded-lg p-1.5 items-center justify-between gap-3 overflow-hidden select-all focus-within:border-indigo-500/50"> <span className="font-mono text-xs text-indigo-400 truncate pl-3 flex-1 select-all select-text"> {getM3uLinkUrl()} </span> <button onClick={() => handleCopy(getM3uLinkUrl(), "m3ulink")} className="px-3 h-8 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded text-xs font-medium transition duration-150 shrink-0 flex items-center gap-1.5" title="Copy link to clipboard" id="copy-m3u-link" > {copiedText === "m3ulink" ? ( <> <Check className="w-3.5 h-3.5 text-emerald-400" /> <span className="text-emerald-400">Copied!</span> </> ) : ( <> <Copy className="w-3.5 h-3.5" /> <span>Copy Link</span> </> )} </button> </div> </div>
{/* Tab Navigation Menu */} <div className="flex border-b border-white/10 bg-[#0f0f10] p-1 rounded-t-xl" id="tabs"> {[ { id: "streams", label: "Active Servers", icon: Tv }, { id: "scraper", label: "Crawler Config", icon: Settings }, { id: "logs", label: "System Traces", icon: Terminal } ].map((tab) => { const Icon = tab.icon; return ( <button key={tab.id} onClick={() => setActiveTab(tab.id as any)} className={`flex-1 flex items-center justify-center gap-2 py-3 text-xs font-semibold tracking-wider uppercase transition duration-150 ${ activeTab === tab.id ? "text-white bg-white/5 border-b-2 border-indigo-500" : "text-zinc-500 hover:text-zinc-300" }`} id={`tab-${tab.id}`} > <Icon className="w-3.5 h-3.5" /> <span className="hidden sm:inline">{tab.label}</span> {tab.id === "streams" && ( <span className="text-[10px] bg-white/10 px-1.5 py-0.2 rounded font-mono text-indigo-300"> {channels.length} </span> )} </button> ); })} </div>
{/* Dynamic Tab Panel Contents */} <div className="flex-1" id="tab-content"> {activeTab === "streams" && ( <div className="flex flex-col space-y-3" id="streams-list"> {channels.map((ch) => { const isOpenLogs = openLogsId === ch.id;
return ( <div key={ch.id} className="bg-[#0f0f10] border rounded-xl overflow-hidden shadow-sm transition-all duration-150 border-white/10 hover:border-zinc-700" id={`channel-card-${ch.id}`} > <div className="p-4 flex flex-col md:flex-row items-start md:items-center justify-between gap-4"> <div className="flex items-center gap-3.5 flex-1 min-w-0"> {/* Logo frame matching aesthetic card design */} <div className="w-11 h-11 rounded bg-[#050505] flex items-center justify-center p-1.5 border border-white/5 shrink-0"> <img src={ch.logo || "https://cdn-icons-png.flaticon.com/512/861/861512.png"} alt={ch.name} className="w-full h-full object-contain" onError={(e) => { (e.target as HTMLImageElement).src = "https://cdn-icons-png.flaticon.com/512/861/861512.png"; }} referrerPolicy="no-referrer" /> </div>
<div className="flex-1 min-w-0"> <div className="flex items-center gap-2 flex-wrap"> <h3 className="font-semibold text-white tracking-tight truncate text-sm"> {ch.name} </h3> {/* Sleek status indicators matching the Elegant Dark design */} <span className={`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-mono uppercase tracking-wider font-semibold ${ ch.status === "Active" ? "bg-emerald-500/10 text-emerald-400 border border-emerald-500/20" : ch.status === "Override" ? "bg-amber-500/10 text-amber-400 border border-amber-500/20" : ch.status === "Pending" ? "bg-indigo-300/10 text-indigo-300 border border-indigo-500/20" : "bg-rose-500/10 text-rose-400 border border-rose-500/20" }`}> <span className={`h-1 w-1 rounded-full ${ ch.status === "Active" ? "bg-emerald-400 animate-pulse" : ch.status === "Override" ? "bg-amber-400 animate-pulse" : ch.status === "Pending" ? "bg-indigo-400 animate-pulse" : "bg-rose-400" }`}></span> {ch.status} </span> </div> <p className="text-[11px] text-zinc-500 truncate mt-1.5 flex items-center gap-1"> <span className="font-mono text-zinc-600">SOURCE:</span> <span className="truncate text-zinc-400 select-all font-mono">{ch.url}</span> </p> </div> </div>
{/* Stream Action triggers */} <div className="flex items-center gap-1.5 self-stretch md:self-auto justify-end border-t border-white/5 md:border-transparent pt-3 md:pt-0 shrink-0"> <button onClick={() => startEditChannel(ch)} className="w-8 h-8 rounded bg-white/5 text-zinc-400 hover:text-white hover:bg-white/10 flex items-center justify-center transition" title="Edit overrides or servers URL" id={`edit-sources-ch-${ch.id}`} > <Edit3 className="w-3.5 h-3.5" /> </button> <button onClick={() => setOpenLogsId(isOpenLogs ? null : ch.id)} className={`h-8 px-3 text-[10px] font-mono tracking-wider font-semibold rounded border transition ${ isOpenLogs ? "border-indigo-500/50 bg-[#4f46e5]/10 text-white" : "border-white/10 text-zinc-400 hover:text-white bg-white/5" }`} id={`logs-toggle-${ch.id}`} > {isOpenLogs ? "HIDE TRACE" : "VIEW TRACE"} </button> </div> </div>
{/* 24-Hour Success Rate Sparkline Grid */} {(() => { const history = generateHistory(ch.id, ch.status, ch.lastTested); const uptimeRate = Math.round((history.filter((item) => item.status === "success" || item.status === "warning").length / 24) * 100); return ( <div className="border-t border-white/[0.04] bg-[#050505]/20 px-4 py-2.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3"> <div className="flex items-center gap-2"> <span className="text-[10px] font-mono uppercase font-bold tracking-widest text-[#71717a]"> 24h Success Rate: </span> <span className={`text-[11px] font-mono font-extrabold ${ uptimeRate >= 90 ? "text-emerald-400" : uptimeRate >= 70 ? "text-amber-400" : "text-rose-400" }`}> {uptimeRate}% </span> </div> {/* Graphical Mini Bar Chart Sparkline */} <div className="flex items-end gap-[4px] h-6 flex-grow max-w-full sm:max-w-[280px] md:max-w-[340px] justify-start sm:justify-end"> {history.map((item, idx) => { let colorClass = "bg-emerald-500/50 hover:bg-emerald-400"; if (item.status === "warning") colorClass = "bg-amber-500/60 hover:bg-amber-400"; if (item.status === "error") colorClass = "bg-rose-500/50 hover:bg-rose-400"; // Map responseTimeMs to relative height (min 20%, max 100% of container height) const heightPercent = Math.max(20, Math.min(100, (item.responseTimeMs / 1600) * 100)); return ( <div key={idx} className="w-[8px] sm:w-[9px] rounded-t-[1.5px] transition-all cursor-crosshair group relative" style={{ height: `${heightPercent}%` }} id={`history-${ch.id}-${idx}`} > <div className={`w-full h-full rounded-t-[1.5px] ${colorClass}`} /> {/* Glassy, elegant hover tooltip */} <div className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-50 bg-[#0a0a0b] border border-white/10 text-[9px] font-mono text-zinc-300 rounded p-2 whitespace-nowrap shadow-xl pointer-events-none"> <p className="font-bold text-white border-b border-white/5 pb-1 mb-1">Hour -{item.hour} Ago</p> <p className="flex items-center gap-1.5"> <span className="text-zinc-500">Status:</span> <span className={ item.status === "success" ? "text-emerald-400" : item.status === "warning" ? "text-amber-400" : "text-rose-400" }> {item.status === "success" ? "SUCCESS (ACTIVE)" : item.status === "warning" ? "WARNING/OVERRIDE" : "ERROR/OFFLINE"} </span> </p> <p className="text-[8px] text-zinc-500 mt-0.5">Latency: <span className="text-zinc-300">{item.responseTimeMs}ms</span></p> </div> </div> ); })} </div> </div> ); })()}
{ch.m3u8Url && ( <div className="px-4 pb-3.5 pt-0.5 space-y-2"> <div> <label className="text-[9px] uppercase font-bold tracking-widest text-[#71717a] block mb-1"> Extracted Stream Target Link </label> <div className="flex items-center justify-between bg-[#050505] border border-white/5 rounded p-2 overflow-hidden"> <span className="font-mono text-xs text-indigo-300 truncate select-all"> {ch.m3u8Url} </span> <button onClick={() => handleCopy(ch.m3u8Url!, `stream-${ch.id}`)} className="px-2 py-1 hover:bg-white/5 text-zinc-400 hover:text-white transition rounded text-[10px] font-mono" id={`copy-stream-${ch.id}`} > {copiedText === `stream-${ch.id}` ? ( <span className="text-emerald-400 font-bold uppercase">Copied</span> ) : ( <span className="uppercase text-zinc-500 hover:text-indigo-400">COPY</span> )} </button> </div> </div>
{/* Connection Headers Panel */} <div className="grid grid-cols-1 md:grid-cols-2 gap-2 bg-[#050505]/40 border border-white/5 rounded p-2.5 text-[10px] font-mono"> <div className="flex flex-col gap-0.5"> <span className="text-[8px] uppercase font-bold text-[#71717a] tracking-wider">Host Header</span> <div className="flex items-center justify-between gap-1 bg-[#0a0a0b]/80 py-1 px-1.5 rounded border border-white/5"> <span className="text-[#a1a1aa] truncate select-all"> {(() => { try { return new URL(ch.m3u8Url).host; } catch (_) { return "N/A"; } })()} </span> <button onClick={() => { try { handleCopy(new URL(ch.m3u8Url!).host, `host-${ch.id}`); } catch(_) {} }} className="text-[8px] font-bold text-zinc-500 hover:text-indigo-400 font-sans px-1 shrink-0" > {copiedText === `host-${ch.id}` ? "COPIED" : "COPY"} </button> </div> </div>
<div className="flex flex-col gap-0.5"> <span className="text-[8px] uppercase font-bold text-[#71717a] tracking-wider">Referer Header</span> <div className="flex items-center justify-between gap-1 bg-[#0a0a0b]/80 py-1 px-1.5 rounded border border-white/5"> <span className="text-[#a1a1aa] truncate select-all"> {ch.referer || config.referer || "N/A"} </span> <button onClick={() => handleCopy(ch.referer || config.referer || "N/A", `ref-${ch.id}`)} className="text-[8px] font-bold text-zinc-500 hover:text-indigo-400 font-sans px-1 shrink-0" > {copiedText === `ref-${ch.id}` ? "COPIED" : "COPY"} </button> </div> </div>
<div className="flex flex-col gap-0.5"> <span className="text-[8px] uppercase font-bold text-[#71717a] tracking-wider">User-Agent Header</span> <div className="flex items-center justify-between gap-1 bg-[#0a0a0b]/80 py-1 px-1.5 rounded border border-white/5"> <span className="text-[#a1a1aa] truncate select-all"> {config.userAgent || "N/A"} </span> <button onClick={() => handleCopy(config.userAgent || "N/A", `ua-${ch.id}`)} className="text-[8px] font-bold text-zinc-500 hover:text-indigo-400 font-sans px-1 shrink-0" > {copiedText === `ua-${ch.id}` ? "COPIED" : "COPY"} </button> </div> </div>
<div className="flex flex-col gap-0.5"> <span className="text-[8px] uppercase font-bold text-[#71717a] tracking-wider">Session Cookie</span> <div className="flex items-center justify-between gap-1 bg-[#0a0a0b]/80 py-1 px-1.5 rounded border border-white/5"> <span className="text-zinc-600 truncate select-all italic"> No cookie headers required </span> <span className="text-[8px] font-bold text-zinc-700 select-none font-sans px-1 shrink-0"> NONE </span> </div> </div> </div> </div> )}
{/* Expanded Extraction log tracing */} <AnimatePresence> {isOpenLogs && ( <motion.div initial={{ height: 0, opacity: 0 }} animate={{ height: "auto", opacity: 1 }} exit={{ height: 0, opacity: 0 }} className="border-t border-white/5 bg-[#050505] p-4 font-mono" id={`ch-logs-container-${ch.id}`} > <h4 className="text-[10px] font-bold uppercase text-zinc-500 mb-2 tracking-widest flex items-center justify-between"> <span>Trace Diagnostics Dump</span> <span>Target Node #{ch.id}</span> </h4> <div className="max-h-60 overflow-y-auto font-mono text-[11px] leading-relaxed text-[#d1d1d1] p-3 rounded bg-[#0a0a0b] space-y-1 select-text"> {ch.logs.length === 0 ? ( <p className="text-zinc-650 italic">No logs recorded yet. Crawl using 'Manual Update' to trigger retrieval.</p> ) : ( ch.logs.map((logStr, idx) => ( <div key={idx} className="whitespace-pre-wrap select-text border-b border-white/5 pb-1 last:border-0 last:pb-0">{logStr}</div> )) )} </div> </motion.div> )} </AnimatePresence> </div> ); })} </div> )}
{activeTab === "scraper" && ( <div className="bg-[#0f0f10] border border-white/10 rounded-xl p-5 sm:p-6 shadow-xl flex flex-col gap-4" id="scraper-settings"> <h3 className="text-sm font-semibold tracking-wider text-white uppercase border-b border-white/5 pb-3.5 flex items-center gap-2"> <Globe className="w-4 h-4 text-indigo-400" /> Crawler Engine Configuration </h3>
<p className="text-xs text-[#a1a1aa] leading-relaxed"> Modify user-agent identity values and target referrer configurations. Spoofing these parameters helps resolve CORS bypasses or server anti-scraper challenges. </p>
<div className="flex flex-col gap-1.5"> <label className="text-[11px] font-bold text-zinc-400 uppercase tracking-wider">User-Agent Spoofer Header</label> <input type="text" value={editUserAgent} onChange={(e) => setEditUserAgent(e.target.value)} className="w-full bg-[#050505] border border-white/15 rounded p-2.5 text-xs text-[#d1d1d1] font-mono focus:border-indigo-500/50 focus:outline-none" placeholder="Mozilla/5.0..." /> </div>
<div className="flex flex-col gap-1.5"> <label className="text-[11px] font-bold text-zinc-400 uppercase tracking-wider">Scraping Referer URL</label> <input type="text" value={editReferer} onChange={(e) => setEditReferer(e.target.value)} className="w-full bg-[#050505] border border-white/15 rounded p-2.5 text-xs text-[#d1d1d1] font-mono focus:border-indigo-500/50 focus:outline-none" placeholder="https://referer.example.com/" /> </div>
<div className="flex flex-col gap-1.5"> <label className="text-[11px] font-bold text-zinc-400 uppercase tracking-wider">Cron Refresh Rate (Minutes)</label> <div className="flex items-center gap-3"> <input type="number" value={editIntervalMinutes} min={1} onChange={(e) => setEditIntervalMinutes(parseInt(e.target.value) || 60)} className="w-28 bg-[#050505] border border-white/15 rounded p-2.5 text-xs text-[#d1d1d1] font-mono focus:border-indigo-500/50 focus:outline-none" /> <span className="text-xs text-[#71717a]"> Playlist is refreshed via background cron processes periodically based on this set value. </span> </div> </div>
<div className="border-t border-white/5 pt-5 mt-2 space-y-4"> <div className="flex items-center justify-between"> <div className="space-y-0.5"> <h4 className="text-xs font-bold text-indigo-400 uppercase tracking-widest flex items-center gap-1.5"> <Terminal className="w-3.5 h-3.5" /> Hugging Face Space Synchronization </h4> <p className="text-[11px] text-zinc-500 leading-relaxed"> Securely automate pushes of your updated `.m3u` files directly back to a Hugging Face Space. </p> </div> <label className="relative inline-flex items-center cursor-pointer"> <input type="checkbox" checked={editEnableHfPush} onChange={(e) => setEditEnableHfPush(e.target.checked)} className="sr-only peer" /> <div className="w-9 h-5 bg-zinc-800 rounded-full peer peer-focus:ring-0 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-zinc-400 after:border-zinc-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-indigo-500 peer-checked:after:bg-white peer-checked:after:border-indigo-600"></div> </label> </div>
{editEnableHfPush && ( <div className="space-y-4 animate-fadeIn"> <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> <div className="flex flex-col gap-1.5"> <label className="text-[10px] font-bold text-zinc-400 uppercase tracking-widest">Hugging Face User Token</label> <input type="password" value={editHfToken} onChange={(e) => setEditHfToken(e.target.value)} className="w-full bg-[#050505] border border-white/10 rounded p-2.5 text-xs text-white font-mono focus:border-indigo-500/50 focus:outline-none" placeholder="hf_..." /> </div>
<div className="flex flex-col gap-1.5"> <label className="text-[10px] font-bold text-zinc-400 uppercase tracking-widest">Target Space Repository Path</label> <input type="text" value={editHfSpace} onChange={(e) => setEditHfSpace(e.target.value)} className="w-full bg-[#050505] border border-white/10 rounded p-2.5 text-xs text-indigo-300 font-mono focus:border-indigo-500/50 focus:outline-none" placeholder="username/space-name" /> </div> </div>
<div className="flex items-center gap-2 text-[10px] text-zinc-500 bg-indigo-500/5 border border-indigo-500/10 p-2.5 rounded-lg select-none"> <span className="text-indigo-400 select-none">ℹ</span> <span> When enabled, successfully extracted live channels automatically compile and push standard <strong>VLC formats</strong> to your Space file <code>yallashoot_playlist.m3u</code>. </span> </div> </div> )} </div>
<button onClick={saveScraperConfig} className="mt-4 self-start px-5 py-2.5 bg-[#4f46e5] hover:bg-indigo-700 text-white font-semibold text-xs rounded transition flex items-center gap-1.5" id="save-scraper-config" > <Save className="w-3.5 h-3.5" /> Save Settings </button> </div> )}
{activeTab === "logs" && ( <div className="bg-[#0f0f10] border border-white/10 rounded-xl p-5 sm:p-6 shadow-xl flex flex-col gap-4" id="cron-logs"> <div className="flex items-center justify-between border-b border-white/5 pb-3"> <h3 className="text-sm font-semibold tracking-wider text-white uppercase flex items-center gap-2"> <Terminal className="w-4 h-4 text-indigo-400" /> Overall Extractor Status Stream </h3> <span className="text-[9px] font-mono uppercase tracking-widest text-indigo-400 bg-indigo-500/5 px-2.5 py-0.5 rounded border border-indigo-500/20"> Cron Streams </span> </div>
<p className="text-xs text-[#a1a1aa]"> Audit log records tracking hourly scraping processes and cron synchronization cycles. </p>
<div className="bg-[#050505] border border-white/10 rounded-lg p-4 font-mono text-[11px] text-[#d1d1d1] select-text max-h-[350px] overflow-auto flex flex-col gap-1.5"> {globalLogs.length === 0 ? ( <span className="text-[#71717a] italic block">No cron operations recorded yet. Updates compile background loops automagically.</span> ) : ( globalLogs.map((log, idx) => ( <div key={idx} className="border-b border-[#0f0f10] pb-1.5 last:border-0 font-light select-text flex items-start gap-2"> <span className="text-indigo-500 select-none">▶</span> <span className="select-text leading-relaxed">{log}</span> </div> )) )} </div> </div> )} </div> </section>
{/* Right Column - Status Stage & Video Player (5/12 width) */} <section className="lg:col-span-5 flex flex-col space-y-6" id="right-section"> {/* Quick Metrics Panels */} <div className="grid grid-cols-3 gap-3" id="metric-grid"> <div className="bg-[#0f0f10] border border-white/10 p-3.5 rounded-xl"> <p className="text-[9px] text-[#71717a] uppercase tracking-widest font-semibold">Total Nodes</p> <h4 className="text-lg font-mono text-white mt-1">{totalCount}</h4> </div> <div className="bg-[#0f0f10] border border-white/10 p-3.5 rounded-xl"> <p className="text-[9px] text-[#71717a] uppercase tracking-widest font-semibold">Success</p> <h4 className="text-lg font-mono text-emerald-400 mt-1">{successPercentage}%</h4> </div> <div className="bg-[#0f0f10] border border-white/10 p-3.5 rounded-xl"> <p className="text-[9px] text-[#71717a] uppercase tracking-widest font-semibold">Status</p> <h4 className="text-lg font-mono text-indigo-400 mt-1 flex items-center gap-1"> <span className="h-1.5 w-1.5 rounded-full bg-indigo-400 animate-pulse"></span> LIVE </h4> </div> </div>
{/* Master insights card matching the look */} <div className="bg-[#0f0f10] border border-white/10 rounded-xl p-5 shadow-lg relative overflow-hidden" id="info-module"> <h3 className="text-xs font-semibold text-white uppercase tracking-wider mb-3 flex items-center gap-2"> <Cpu className="w-4 h-4 text-indigo-400" /> Automator Diagnostics Log </h3> <ul className="space-y-2.5 text-xs text-zinc-400 leading-relaxed"> <li className="flex gap-2"> <span className="text-indigo-500 select-none">•</span> <span> <strong>Crawler Engine Ref:</strong> Uses inline Base64 reverse regex decryptors to extract obfuscated m3u8 addresses. </span> </li> <li className="flex gap-2"> <span className="text-indigo-500 select-none">•</span> <span> <strong>Dynamic Auto Cron:</strong> Syncs to cloud run endpoints safely, building direct player headers and VLC configurations. </span> </li> </ul> </div> </section> </main>
{/* Edit Component Dialogue Overlay Modal */} <AnimatePresence> {editingChannel && ( <div className="fixed inset-0 z-50 bg-[#0a0a0b]/80 backdrop-blur-sm flex items-center justify-center p-4 animate-fadeIn" id="edit-channel-modal"> <motion.div initial={{ scale: 0.95, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} exit={{ scale: 0.95, opacity: 0 }} className="bg-[#0f0f10] border border-white/10 rounded-xl p-6 shadow-2xl max-w-lg w-full flex flex-col gap-4 relative" > <h3 className="text-sm font-bold text-white uppercase tracking-wider flex items-center gap-2"> <Edit3 className="w-3.5 h-3.5 text-indigo-400" /> Configure: {editingChannel.name} </h3> <div className="flex flex-col gap-1 text-xs"> <label className="font-bold text-zinc-400 uppercase tracking-widest text-[9px]">Server Name</label> <input type="text" value={editName} onChange={(e) => setEditName(e.target.value)} className="w-full bg-[#050505] border border-white/10 rounded p-2.5 text-white font-sans focus:border-indigo-500/50 focus:outline-none" /> </div>
<div className="flex flex-col gap-1 text-xs"> <label className="font-bold text-zinc-400 uppercase tracking-widest text-[9px]">Scraper Target URL</label> <input type="text" value={editUrl} onChange={(e) => setEditUrl(e.target.value)} className="w-full bg-[#050505] border border-white/10 rounded p-2.5 text-[#d1d1d1] font-mono focus:border-indigo-500/50 focus:outline-none" /> </div>
<div className="flex flex-col gap-1 text-xs"> <label className="font-bold text-zinc-400 uppercase tracking-widest text-[9px]">Logo Icon Asset Link</label> <input type="text" value={editLogo} onChange={(e) => setEditLogo(e.target.value)} className="w-full bg-[#050505] border border-white/10 rounded p-2.5 text-[#d1d1d1] font-mono focus:border-indigo-500/50 focus:outline-none" /> </div>
<div className="border-t border-white/5 pt-3.5 flex flex-col gap-1.5 text-xs"> <div className="flex items-center justify-between"> <label className="font-bold text-amber-400 uppercase tracking-widest text-[9px] flex items-center gap-1"> <AlertCircle className="w-3.5 h-3.5" /> Custom Stream Link Override </label> <span className="text-[9px] text-zinc-600 font-mono">(Crawl Bypass)</span> </div> <input type="text" value={editOverride} onChange={(e) => setEditOverride(e.target.value)} className="w-full bg-[#050505] border border-amber-500/20 rounded p-2.5 text-white font-mono focus:border-amber-500/50 focus:outline-none" placeholder="Paste direct backup .m3u8 link if extractor isn’t needed" /> <p className="text-[10px] text-zinc-500 leading-relaxed"> Pasting a link here freezes extraction on this channel and delivers this override stream directly. </p> </div>
<div className="flex items-center justify-end gap-2 border-t border-white/5 pt-4 mt-2"> <button onClick={() => setEditingChannel(null)} className="px-4 py-2 rounded bg-white/5 hover:bg-white/10 text-zinc-300 font-semibold text-xs transition" > Cancel </button> <button onClick={saveChannelSettings} className="px-4 py-2 rounded bg-[#4f46e5] hover:bg-indigo-700 text-white font-bold text-xs flex items-center gap-1 transition" id="save-channel-btn" > <Save className="w-3.5 h-3.5" /> Save Changes </button> </div> </motion.div> </div> )} </AnimatePresence>
{/* Footer Status Bar matching Elegant Dark Theme */} <footer className="h-12 bg-[#0f0f10] border-t border-white/10 px-6 flex flex-col sm:flex-row items-center justify-between text-[10px] text-zinc-500 uppercase tracking-[0.15em] mt-12"> <div className="flex space-x-6 py-2 sm:py-0"> <span>Status: <span className="text-emerald-400 font-bold">Operational</span></span> <span>Cron Schedule: <span className="text-white font-mono">0 * * * *</span></span> </div> <div className="flex space-x-6 py-2 sm:py-0 font-light"> <span>CPU: <span className="text-white font-medium">12%</span></span> <span>MEM: <span className="text-white font-medium font-mono">256MB</span></span> <span className="text-indigo-400 font-semibold">v2.1.0-stable</span> </div> </footer> </div> );}1234567891011121314151617181920212223242526@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');@import "tailwindcss";
@theme { --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif; --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;}
/* Custom scrollbars for a premium developer slate experience */::-webkit-scrollbar { width: 8px; height: 8px;}
::-webkit-scrollbar-track { background: #090d16;}
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px;}
::-webkit-scrollbar-thumb:hover { background: #334155;}12345678910import {StrictMode} from 'react';import {createRoot} from 'react-dom/client';import App from './App.tsx';import './index.css';
createRoot(document.getElementById('root')!).render( <StrictMode> <App /> </StrictMode>,);1234567891011121314151617181920212223242526{ "compilerOptions": { "target": "ES2022", "experimentalDecorators": true, "useDefineForClassFields": false, "module": "ESNext", "lib": [ "ES2022", "DOM", "DOM.Iterable" ], "skipLibCheck": true, "moduleResolution": "bundler", "isolatedModules": true, "moduleDetection": "force", "allowJs": true, "jsx": "react-jsx", "paths": { "@/*": [ "./*" ] }, "allowImportingTsExtensions": true, "noEmit": true }}12345678910111213141516171819202122import tailwindcss from '@tailwindcss/vite';import react from '@vitejs/plugin-react';import path from 'path';import {defineConfig} from 'vite';
export default defineConfig(() => { return { plugins: [react(), tailwindcss()], resolve: { alias: { '@': path.resolve(__dirname, '.'), }, }, server: { // HMR is disabled in AI Studio via DISABLE_HMR env var. // Do not modifyâfile watching is disabled to prevent flickering during agent edits. hmr: process.env.DISABLE_HMR !== 'true', // Disable file watching when DISABLE_HMR is true to save CPU during agent edits. watch: process.env.DISABLE_HMR === 'true' ? null : {}, }, };});1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#EXTM3U#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",Alba Max - Server 2#EXTVLCOPT:http-referrer=https://top.poiy.online/albaplayer/max1/?serv=2#EXTVLCOPT:http-origin=https://top.poiy.onlinehttps://s3.us-east-2.amazonaws.com/cdnh123/hls/0/stream.m3u8#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",Alba Max - Server 3#EXTVLCOPT:http-referrer=https://top.poiy.online/albaplayer/max1/?serv=3#EXTVLCOPT:http-origin=https://top.poiy.onlinehttps://edge22.776740.ir.cdn.ir/hls2/sport.m3u8#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",Alba Max - Server 6#EXTVLCOPT:http-referrer=https://d2184b0e8479257bee73320aec945ffc.dyngutter.net/#EXTVLCOPT:http-origin=https://d2184b0e8479257bee73320aec945ffc.dyngutter.nethttps://n949rkq40t1l.54434687.net:8443/hls/ulgk1vzsw8aqr.m3u8?s=gYgHj9nBkdXtzWlGZCIUqg&e=1782213917#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - TSN 1#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=1EOXM4BabPe40vjYEQI3Nw&expires=1782197119&ch=tsn1ca&s=23043696c6912d6bbb7611f7d30031c7#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - ITV 1#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/itv111.m3u8?md5=3dY4hELFeXLUrIs3btavAg&expires=1782197121&ch=itv111&s=eb517edddcae6722f178748202c12769#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Premier Sports#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/daznlaliga.m3u8?md5=q0Fgjr8bLGhd0e21WI_79g&expires=1782197122&ch=daznlaliga&s=e76e6778b1f4a32bd5dcfde7b3dfea33#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Sports CH 45#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/spch45.m3u8?md5=VtVLH0EY5QYVKNy-H_ASEA&expires=1782197123&ch=spch45&s=472e48a51eb8b5e4ce1f1dd8509df460#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Bein Sport 1 FR#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/bsp1fr.m3u8?md5=ER8O08T2Xm-VNGKAsTwUYQ&expires=1782197124&ch=bsp1fr&s=7c29ace716a6f1c299f52dc44ba72911#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - ZDF#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/zdf.m3u8?md5=Jf709eJIDYeaeOykq9wPKw&expires=1782197125&ch=zdf&s=a5ca88224d60e3325ff422b0348ac7e0#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - TSN 3#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/tsn3ca.m3u8?md5=wtRwMX7Z1gg-y362F-wodg&expires=1782197127&ch=tsn3ca&s=6491bea32288c4c59853db2e534a346a#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Sports CH 9#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/spch9.m3u8?md5=UnXgSGQGmA4sD7kVajNM_g&expires=1782197128&ch=spch9&s=3497a1cd012e6f5d5ed5d324f20e701f#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - TSN 1 CA#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/tsn1ca.m3u8?md5=XZG-iMNUXEyGCDcuOqBnNQ&expires=1782197129&ch=tsn1ca&s=384d6371c6791399513a02978c34959a#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - BBC 1#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/bbc1ld.m3u8?md5=pevdCN1G6vE1npd6cdBzJw&expires=1782197130&ch=bbc1ld&s=fb0e8cc1bac27e81b600d850ebca7fd5#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Sports CH 10#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/spch10.m3u8?md5=OSorX_5zX16GE2k-VVjg2A&expires=1782197131&ch=spch10&s=e092c0ef319a4584495f69c2324b7ef5#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Sports CH 159#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/yt39.m3u8?md5=HUk6MQVvruyk44YcA6bC_g&expires=1782197132&ch=yt39&s=41b100aa2f37db1c0cd977290a8f9c91#EXTINF:-1 tvg-logo="https://cdn-icons-png.flaticon.com/512/861/861512.png",AIO Player - Sports CH 41#EXTVLCOPT:http-referrer=https://bhalocast.pro/#EXTVLCOPT:http-origin=https://bhalocast.prohttps://dz5.bhalocast.pro:7059/hls/spch41.m3u8?md5=L4fe_JqKZKFcL4yEE6MNSg&expires=1782197133&ch=spch41&s=ad2815f3a4007b287306ec035f90da8f.dockerignoreAdded+7
.gitattributesDeleted-35
.gitignoreAdded+8
DockerfileAdded+29
README.md+7-4
data/config.jsonAdded+545
decoded_block_0.txtAdded
index.htmlAdded+13
metadata.jsonAdded+6
package.jsonAdded+38
push-full-project.tsAdded+197
requirements.txtDeleted
server.tsAdded+973
src/App.tsxAdded+973
src/index.cssAdded+26
src/main.tsxAdded+10
tsconfig.jsonAdded+26
vite.config.tsAdded+22
yallashoot_playlist.m3uDeleted-65