<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
    <channel>
        <title>  Пермакультура   - UX</title>
        <link>http://gs-permakultura-v-ukran.mozello.com/ux-1/</link>
        <description>  Пермакультура   - UX</description>
                    <item>
                <title>Перша новина</title>
                <link>http://gs-permakultura-v-ukran.mozello.com/ux-1/params/post/5255060/persha-novina</link>
                <pubDate>Tue, 19 May 2026 00:28:00 +0000</pubDate>
                <description>&lt;p&gt;1&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;


    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;title&gt;YouTube Blog Article Generator&lt;/title&gt;
    &lt;!-- Bootstrap 5 CSS --&gt;
    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&gt;
    &lt;!-- Bootstrap Icons --&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css&quot;&gt;
    &lt;style&gt;
        body {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        main {
            flex: 1;
        }
        .preview-box {
            background-color: #ffffff;
            color: #212529;
            border-radius: 8px;
        }
        [data-bs-theme=&quot;dark&quot;] .preview-box {
            background-color: #1e1e1e;
            color: #e0e0e0;
        }
        code-block {
            font-family: monospace;
            white-space: pre-wrap;
        }
    &lt;/style&gt;



    &lt;!-- Шапка / Навігація --&gt;
    &lt;nav class=&quot;navbar navbar-expand-lg bg-body-tertiary border-bottom&quot;&gt;
        &lt;div class=&quot;container-fluid&quot;&gt;
            &lt;a class=&quot;navbar-brand fw-bold&quot; href=&quot;#&quot;&gt;
                &lt;i class=&quot;bi bi-youtube text-danger&quot;&gt;&lt;/i&gt; YouTube Article Generator
            &lt;/a&gt;
            &lt;button class=&quot;btn btn-outline-secondary btn-sm&quot; id=&quot;themeToggle&quot; type=&quot;button&quot;&gt;
                &lt;i class=&quot;bi bi-moon-stars-fill&quot;&gt;&lt;/i&gt; Tema
            &lt;/button&gt;
        &lt;/div&gt;
    &lt;/nav&gt;

    &lt;!-- Основна частина --&gt;
    &lt;main class=&quot;container my-4&quot;&gt;
        
        &lt;!-- Панель вводу та ключів --&gt;
        &lt;div class=&quot;card shadow-sm mb-4&quot;&gt;
            &lt;div class=&quot;card-body&quot;&gt;
                &lt;h5 class=&quot;card-title mb-3&quot;&gt;&lt;i class=&quot;bi bi-gear-fill text-primary&quot;&gt;&lt;/i&gt; Налаштування та вхідні дані&lt;/h5&gt;
                
                &lt;div class=&quot;mb-3&quot;&gt;
                    &lt;label for=&quot;apiKey&quot; class=&quot;form-label font-monospace&quot;&gt;OpenAI API Key (потрібен для генерації):&lt;/label&gt;
                    &lt;input type=&quot;password&quot; id=&quot;apiKey&quot; class=&quot;form-control&quot; placeholder=&quot;sk-proj-...&quot;&gt;
                    &lt;div class=&quot;form-text&quot;&gt;Ключ зберігається лише у вашому браузері та не передається на сторонні сервери.&lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&quot;mb-3&quot;&gt;
                    &lt;label for=&quot;youtubeUrl&quot; class=&quot;form-label fw-bold&quot;&gt;Посилання на YouTube відео або текст транскрипту:&lt;/label&gt;
                    &lt;div class=&quot;input-group&quot;&gt;
                        &lt;input type=&quot;text&quot; id=&quot;youtubeUrl&quot; class=&quot;form-control form-control-lg&quot; placeholder=&quot;https://www.youtube.com/watch?v=... або вставте текст субтитрів&quot;&gt;
                        &lt;button class=&quot;btn btn-primary px-4 fw-bold&quot; type=&quot;button&quot; id=&quot;generateBtn&quot;&gt;
                            
                            Згенерувати статтю
                        &lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;

                &lt;!-- Індикатор прогресу --&gt;
                &lt;div class=&quot;progress d-none mt-3&quot; style=&quot;height: 10px;&quot; id=&quot;progressBarContainer&quot;&gt;
                    &lt;div class=&quot;progress-bar progress-bar-striped progress-bar-animated bg-success&quot; id=&quot;progressBar&quot; role=&quot;progressbar&quot; style=&quot;width: 100%&quot;&gt;&lt;/div&gt;
                &lt;/div&gt;
                &lt;div id=&quot;statusText&quot; class=&quot;form-text text-center mt-1 text-info&quot;&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;!-- Блок результатів --&gt;
        &lt;div class=&quot;card shadow-sm d-none&quot; id=&quot;resultCard&quot;&gt;
            &lt;div class=&quot;card-header&quot;&gt;
                &lt;ul class=&quot;nav nav-tabs card-header-tabs&quot; id=&quot;resultTabs&quot; role=&quot;tablist&quot;&gt;
                    &lt;li class=&quot;nav-item&quot;&gt;
                        &lt;button class=&quot;nav-link active&quot; id=&quot;preview-tab&quot; data-bs-toggle=&quot;tab&quot; data-bs-target=&quot;#previewPane&quot; type=&quot;button&quot;&gt;Візуальний перегляд&lt;/button&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;nav-item&quot;&gt;
                        &lt;button class=&quot;nav-link&quot; id=&quot;html-tab&quot; data-bs-toggle=&quot;tab&quot; data-bs-target=&quot;#htmlPane&quot; type=&quot;button&quot;&gt;HTML Код&lt;/button&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;nav-item&quot;&gt;
                        &lt;button class=&quot;nav-link&quot; id=&quot;seo-tab&quot; data-bs-toggle=&quot;tab&quot; data-bs-target=&quot;#seoPane&quot; type=&quot;button&quot;&gt;SEO Метадані&lt;/button&gt;
                    &lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;div class=&quot;card-body&quot;&gt;
                &lt;div class=&quot;tab-content&quot; id=&quot;resultTabContent&quot;&gt;
                    
                    &lt;!-- Вкладка Попередній перегляд --&gt;
                    &lt;div class=&quot;tab-pane fade show active&quot; id=&quot;previewPane&quot; role=&quot;tabpanel&quot;&gt;
                        &lt;div class=&quot;d-flex justify-content-end mb-3&quot;&gt;
                            &lt;button class=&quot;btn btn-sm btn-outline-success me-2&quot; id=&quot;copyTextBtn&quot;&gt;
                                &lt;i class=&quot;bi bi-file-earmark-text&quot;&gt;&lt;/i&gt; Скопіювати як текст
                            &lt;/button&gt;
                        &lt;/div&gt;
                        &lt;div class=&quot;preview-box p-4 border rounded shadow-sm&quot; id=&quot;previewContainer&quot;&gt;&lt;/div&gt;
                    &lt;/div&gt;

                    &lt;!-- Вкладка HTML --&gt;
                    &lt;div class=&quot;tab-pane fade&quot; id=&quot;htmlPane&quot; role=&quot;tabpanel&quot;&gt;
                        &lt;div class=&quot;d-flex justify-content-end mb-3&quot;&gt;
                            &lt;button class=&quot;btn btn-sm btn-outline-primary&quot; id=&quot;copyHtmlBtn&quot;&gt;
                                &lt;i class=&quot;bi bi-clipboard&quot;&gt;&lt;/i&gt; Скопіювати HTML код
                            &lt;/button&gt;
                        &lt;/div&gt;
                        &lt;pre class=&quot;p-3 bg-dark text-light rounded overflow-auto&quot; style=&quot;max-height: 600px;&quot;&gt;&lt;code id=&quot;htmlCodeContainer&quot;&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;

                    &lt;!-- Вкладка SEO --&gt;
                    &lt;div class=&quot;tab-pane fade&quot; id=&quot;seoPane&quot; role=&quot;tabpanel&quot;&gt;
                        &lt;div id=&quot;seoContainer&quot; class=&quot;row g-3&quot;&gt;&lt;/div&gt;
                    &lt;/div&gt;

                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;

    &lt;/main&gt;

    &lt;!-- Bootstrap JS --&gt;
    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;

    &lt;!-- Фронтенд Логіка Скрипта --&gt;
    &lt;script&gt;
        document.addEventListener(&#039;DOMContentLoaded&#039;, () =&gt; {
            const themeToggle = document.getElementById(&#039;themeToggle&#039;);
            const generateBtn = document.getElementById(&#039;generateBtn&#039;);
            const youtubeUrlInput = document.getElementById(&#039;youtubeUrl&#039;);
            const apiKeyInput = document.getElementById(&#039;apiKey&#039;);
            const spinner = document.getElementById(&#039;spinner&#039;);
            const progressBarContainer = document.getElementById(&#039;progressBarContainer&#039;);
            const statusText = document.getElementById(&#039;statusText&#039;);
            const resultCard = document.getElementById(&#039;resultCard&#039;);

            const previewContainer = document.getElementById(&#039;previewContainer&#039;);
            const htmlCodeContainer = document.getElementById(&#039;htmlCodeContainer&#039;);
            const seoContainer = document.getElementById(&#039;seoContainer&#039;);

            // Автозбереження API ключа в LocalStorage браузера
            if (localStorage.getItem(&#039;openai_api_key&#039;)) {
                apiKeyInput.value = localStorage.getItem(&#039;openai_api_key&#039;);
            }

            apiKeyInput.addEventListener(&#039;change&#039;, () =&gt; {
                localStorage.setItem(&#039;openai_api_key&#039;, apiKeyInput.value.trim());
            });

            // Перемикач темно/світлої теми
            themeToggle.addEventListener(&#039;click&#039;, () =&gt; {
                const htmlElement = document.documentElement;
                const currentTheme = htmlElement.getAttribute(&#039;data-bs-theme&#039;);
                const newTheme = currentTheme === &#039;dark&#039; ? &#039;light&#039; : &#039;dark&#039;;
                htmlElement.setAttribute(&#039;data-bs-theme&#039;, newTheme);
            });

            // Обробник натискання кнопки Генерації
            generateBtn.addEventListener(&#039;click&#039;, async () =&gt; {
                const inputData = youtubeUrlInput.value.trim();
                const apiKey = apiKeyInput.value.trim();

                if (!apiKey) {
                    alert(&#039;Будь ласка, введіть свій OpenAI API Key.&#039;);
                    return;
                }

                if (!inputData) {
                    alert(&#039;Введіть текст субтитрів або посилання.&#039;);
                    return;
                }

                // Старт анімації завантаження
                generateBtn.disabled = true;
                spinner.classList.remove(&#039;d-none&#039;);
                progressBarContainer.classList.remove(&#039;d-none&#039;);
                statusText.textContent = &quot;ШІ аналізує та переписує текст у професійну статтю...&quot;;
                resultCard.classList.add(&#039;d-none&#039;);

                try {
                    const generatedData = await generateArticleWithOpenAI(inputData, apiKey);

                    // Відображення результатів
                    previewContainer.innerHTML = generatedData.htmlArticle;
                    htmlCodeContainer.textContent = generatedData.htmlArticle;

                    // Заповнення SEO блоку
                    const seo = generatedData.seo || {};
                    seoContainer.innerHTML = `
                        &lt;div class=&quot;col-md-6&quot;&gt;&lt;strong&gt;SEO Title:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${seo.title || &#039;-&#039;}&lt;/div&gt;&lt;/div&gt;
                        &lt;div class=&quot;col-md-6&quot;&gt;&lt;strong&gt;Slug:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${seo.slug || &#039;-&#039;}&lt;/div&gt;&lt;/div&gt;
                        &lt;div class=&quot;col-12&quot;&gt;&lt;strong&gt;Description:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${seo.description || &#039;-&#039;}&lt;/div&gt;&lt;/div&gt;
                        &lt;div class=&quot;col-md-4&quot;&gt;&lt;strong&gt;Час читання:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${seo.readingTime || &#039;-&#039;}&lt;/div&gt;&lt;/div&gt;
                        &lt;div class=&quot;col-md-4&quot;&gt;&lt;strong&gt;Слів у статті:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${seo.wordCount || &#039;-&#039;}&lt;/div&gt;&lt;/div&gt;
                        &lt;div class=&quot;col-md-4&quot;&gt;&lt;strong&gt;Ключові слова:&lt;/strong&gt; &lt;div class=&quot;border p-2 rounded bg-body-tertiary&quot;&gt;${(seo.keywords || []).join(&#039;, &#039;)}&lt;/div&gt;&lt;/div&gt;
                    `;

                    resultCard.classList.remove(&#039;d-none&#039;);

                } catch (error) {
                    alert(`Помилка генерації: ${error.message}`);
                } finally {
                    generateBtn.disabled = false;
                    spinner.classList.add(&#039;d-none&#039;);
                    progressBarContainer.classList.add(&#039;d-none&#039;);
                    statusText.textContent = &quot;&quot;;
                }
            });

            // Прямий запит до OpenAI API з фронтенду
            async function generateArticleWithOpenAI(textContext, apiKey) {
                const systemPrompt = `Ви — провідний український журналіст, SEO-експерт та фронтенд-розробник. 
Перетворіть наданий текст/субтитри у якісну, структуровану, глибоку статтю українською мовою.

ВИМОГИ:
1. НІКОЛИ не копіюйте текст слово в слово. Перепишіть повністю у журналістському стилі.
2. Використовуйте семантичний HTML5 (теги: &lt;article&gt;, &lt;header&gt;, &lt;section&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;p&gt;, &lt;ul&gt;, &lt;ol&gt;, &lt;li&gt;, &lt;blockquote&gt;, &lt;table&gt;, &lt;thead&gt;, &lt;tbody&gt;, &lt;tr&gt;, &lt;td&gt;, &lt;strong&gt;).
3. Структура: Заголовок H1, Вступ, Кілька розділів H2, Цитати, Таблиця або список, FAQ (з &lt;details&gt; та &lt;summary&gt;), Висновки.
4. Мова: природна українська без росіянізмів та AI-кліше.

Видайте ВІДПОВІДЬ СУВОРO В JSON ФОРМАТІ:
{
  &quot;htmlArticle&quot;: &quot;string з HTML кодом статті&quot;,
  &quot;seo&quot;: {
    &quot;title&quot;: &quot;Заголовок для SEO&quot;,
    &quot;description&quot;: &quot;Опис для метатагу description&quot;,
    &quot;slug&quot;: &quot;chytatylnyy-url-slug&quot;,
    &quot;keywords&quot;: [&quot;слово1&quot;, &quot;слово2&quot;],
    &quot;readingTime&quot;: &quot;X хв&quot;,
    &quot;wordCount&quot;: 1000
  }
}`;

                const response = await fetch(&#039;https://api.openai.com/v1/chat/completions&#039;, {
                    method: &#039;POST&#039;,
                    headers: {
                        &#039;Content-Type&#039;: &#039;application/json&#039;,
                        &#039;Authorization&#039;: `Bearer ${apiKey}`
                    },
                    body: JSON.stringify({
                        model: &#039;gpt-4o&#039;,
                        response_format: { type: &quot;json_object&quot; },
                        messages: [
                            { role: &#039;system&#039;, content: systemPrompt },
                            { role: &#039;user&#039;, content: `Ось вихідний текст:\n\n${textContext}` }
                        ],
                        temperature: 0.5
                    })
                });

                if (!response.ok) {
                    const errData = await response.json();
                    throw new Error(errData.error?.message || &#039;Помилка запиту до OpenAI&#039;);
                }

                const data = await response.json();
                return JSON.parse(data.choices[0].message.content);
            }

            // Копіювання в буфер
            document.getElementById(&#039;copyHtmlBtn&#039;).addEventListener(&#039;click&#039;, () =&gt; {
                navigator.clipboard.writeText(htmlCodeContainer.textContent);
                alert(&#039;HTML код успішно скопійовано!&#039;);
            });

            document.getElementById(&#039;copyTextBtn&#039;).addEventListener(&#039;click&#039;, () =&gt; {
                navigator.clipboard.writeText(previewContainer.innerText);
                alert(&#039;Текст статті скопійовано!&#039;);
            });
        });
    &lt;/script&gt;</description>
            </item>
            </channel>
</rss>