Versions

  • v1

    2/2/2025
    Open: Version
    Changes from v0 to v1
    +48
    -14
    /** @jsxImportSource https://esm.sh/react@18.2.0 */
    import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
    import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";

    // Playwright needs to be imported from esm.sh
    import playwright from "https://esm.sh/playwright-core@1.40.1/lib/client";

    function App() {
    const [isLive, setIsLive] = useState(false);
    ⦚ 23 unchanged lines ⦚
    <div style={{ color: 'gray' }}>⚫ Channel is Offline</div>
    )}
    </div>
    );
    ⦚ 20 unchanged lines ⦚
    <title>Mixcloud Live Status</title>
    <script src="https://esm.town/v/std/catch"></script>
    </head>
    <body>
    <div id="root"></div>
    ⦚ 6 unchanged lines ⦚
    }

    async function checkMixcloudLiveStatus(channelUrl = 'https://www.mixcloud.com/YourChannelName/') {
    // Note: This is a conceptual implementation. Actual scraping might require more robust handling
    try {
    const browser = await playwright.chromium.launch();
    const page = await browser.newPage();
    await page.goto(channelUrl);

    // Wait for potential live badge
    const liveBadge = await page.$('text=LIVE');
    const isLive = !!liveBadge;
    /** @jsxImportSource https://esm.sh/react@18.2.0 */
    import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
    import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";

    function App() {
    const [isLive, setIsLive] = useState(false);
    ⦚ 23 unchanged lines ⦚
    <div style={{ color: 'gray' }}>⚫ Channel is Offline</div>
    )}
    <p>
    <a
    href={import.meta.url.replace("esm.town", "val.town")}
    target="_top"
    style={{ color: '#888', fontSize: '0.8em' }}
    >
    View Val Source
    </a>
    </p>
    </div>
    );
    ⦚ 20 unchanged lines ⦚
    <title>Mixcloud Live Status</title>
    <script src="https://esm.town/v/std/catch"></script>
    <style>${css}</style>
    </head>
    <body>
    <div id="root"></div>
    ⦚ 6 unchanged lines ⦚
    }

    async function checkMixcloudLiveStatus(channelName = 'YourChannelName') {
    try {
    // Alternative approach: Use Mixcloud's RSS feed to check recent uploads
  • v0

    2/2/2025
    Open: Version
    +91
    -0

    /** @jsxImportSource https://esm.sh/react@18.2.0 */
    import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
    import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";

    // Playwright needs to be imported from esm.sh
    import playwright from "https://esm.sh/playwright-core@1.40.1/lib/client";

    function App() {
    const [isLive, setIsLive] = useState(false);

    useEffect(() => {
    async function checkLiveStatus() {
    try {
    const response = await fetch('/check-live-status');
    const data = await response.json();
    setIsLive(data.isLive);
    } catch (error) {
    console.error('Failed to check live status', error);
    }
    }

    checkLiveStatus();
    const interval = setInterval(checkLiveStatus, 5 * 60 * 1000); // Every 5 minutes
    return () => clearInterval(interval);
    }, []);

    return (
    <div>
    <h1>Mixcloud Live Status</h1>
    {isLive ? (
    <div style={{ color: 'green' }}>🔴 Channel is LIVE</div>
    ) : (
    <div style={{ color: 'gray' }}>⚫ Channel is Offline</div>
    )}
    </div>
    );
4
Next
kailhus-checkmixcloudislive.web.val.run
Updated: February 6, 2025