( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/..//tmpr/../tmpr/../tmpr/../tmpr/..//wowX/tools/parse_brandinsights.php
<?php
$md_file = 'c:\wamp64\www\thebrand\wow2\tools\resources\brandinsights.md';
$content = file_get_contents($md_file);
$lines = explode("\n", $content);

$items = [];
$current_title = '';

foreach ($lines as $line) {
    $line = trim($line);
    if (empty($line)) continue;

    // Check for URL
    if (strpos($line, 'https://') !== false) {
        // If line starts with http, previous non-empty line was title
        if (strpos($line, 'https://') === 0) {
            $url = $line;
            $title = $current_title;
        } else {
            // Title and URL on same line
            // format: Title https://...
            $parts = explode('https://', $line, 2);
            $title = trim($parts[0]);
            $url = 'https://' . $parts[1];
        }

        if (!empty($title) && !empty($url)) {
            // Generate a simple ID
            $id = count($items) + 1;
            $items[] = [
                'id' => (string)$id,
                'title' => $title,
                'url' => $url,
                'category' => 'Brand Insights' // Default category
            ];
            $current_title = ''; // Reset
        }
    } else {
        // Potential title for next line
        $current_title = $line;
    }
}

$json_output = json_encode(['brand_insights' => $items], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
file_put_contents('c:\wamp64\www\thebrand\wow2\tools\resources\brand_insights\items.json', $json_output);

echo "Parsed " . count($items) . " items.\n";
?>