Add Activepieces integration for workflow automation

- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,18 @@
{
"extends": ["../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-youtube
This library was generated with [Nx](https://nx.dev).
## Running lint
Run `nx lint pieces-youtube` to execute the lint via [ESLint](https://eslint.org/).

View File

@@ -0,0 +1,8 @@
{
"name": "@activepieces/piece-youtube",
"version": "0.3.19",
"dependencies": {
"cheerio": "1.0.0-rc.12",
"feedparser": "2.2.10"
}
}

View File

@@ -0,0 +1,51 @@
{
"name": "pieces-youtube",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/youtube/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/youtube",
"tsConfig": "packages/pieces/community/youtube/tsconfig.lib.json",
"packageJson": "packages/pieces/community/youtube/package.json",
"main": "packages/pieces/community/youtube/src/index.ts",
"assets": [
"packages/pieces/community/youtube/*.md",
{
"input": "packages/pieces/community/youtube/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
},
"dependsOn": [
"^build",
"prebuild"
]
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
},
"prebuild": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/youtube",
"command": "bun install --no-save --silent"
},
"dependsOn": [
"^build"
]
}
},
"tags": []
}

View File

@@ -0,0 +1,24 @@
{
"YouTube": "YouTube",
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Genieße die Videos und Musik, die du liebst, lade originale Inhalte hoch und teile sie alle mit Freunden, Familie und der Welt auf YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Melden Sie sich bei [Google Cloud Console](https://console.cloud.google.com/).\n 2. Erstellen Sie ein neues Projekt oder Sie können ein bestehendes Projekt verwenden.\n 3. Gehen Sie zu **APIs & Services** und klicken Sie auf **APIs & Services aktivieren**.\n 4. Suche in der Suchleiste nach **YouTube API** und aktiviere sie.\n Gehe zum **OAuth consent screen** und wähle **External** Typ und klicke auf Erstellen.\n 6. Geben Sie den App-Namen, die Support-E-Mail und die Kontaktinformationen für Entwickler ein. Klicken Sie auf den Knopf Speichern und fortfahren.\n Klicken Sie auf **Add or Remove Scopes** und fügen Sie folgende Bereiche hinzu und klicken Sie auf Update.\n - https://www.googleapis.com/auth/youtube\n - https://www. oogleapis.com/auth/youtube.readonly\n - https://www. oogleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube. orce-ssl\n 8. Klicken Sie auf Speichern und Weiter um den Schritt\n 9 zu beenden. Klicken Sie auf den Button Benutzer hinzufügen und fügen Sie eine Test-E-Mail hinzu. Sie können Ihre eigene E-Mail hinzufügen). hen klicken Sie schließlich auf Speichern und fortfahren, um den Test User Teil zu beenden.\n 10. Gehen Sie zu **Anmeldeinformationen**. Klicke auf den Button **Anmeldeinformationen erstellen** und wähle die Option **OAuth client ID** aus.\n 11. Wählen Sie den Anwendungstyp als **Web Application** aus und füllen Sie das Feld Name aus.\n 12. Fügen Sie https://cloud.activepieces.com/redirect im Feld **Autorisierte Weiterleitungs-URIs** hinzu und klicken Sie auf den Erstellen-Button.\n 13. Kopiere **Client-ID** und **Client-Geheimnis**.",
"Custom API Call": "Eigener API-Aufruf",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD",
"New Video In Channel": "Neues Video im Kanal",
"Runs when a new video is added to a YouTube channel": "Läuft wenn ein neues Video zu einem YouTube-Kanal hinzugefügt wird",
"Channel ID, URL, or handle": "Kanal-ID, URL oder Handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube-Kanal-ID, URL oder Handle (z.B. @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Disfruta de los vídeos y la música que amas, sube contenido original y compártelo todo con amigos, familia y el mundo en YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Llamada API personalizada",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO",
"New Video In Channel": "Nuevo canal de vídeo",
"Runs when a new video is added to a YouTube channel": "Ejecuta cuando se añade un nuevo vídeo a un canal de YouTube",
"Channel ID, URL, or handle": "ID del canal, URL o manejador",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "ID del canal de YouTube, URL o manejador (por ejemplo: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Profitez des vidéos et de la musique que vous aimez, téléchargez du contenu original et partagez-les avec vos amis, votre famille et le monde sur YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Appel d'API personnalisé",
"Make a custom API call to a specific endpoint": "Passer un appel API personnalisé à un endpoint spécifique",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'expiration (en secondes)",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "Nouvelle vidéo dans le canal",
"Runs when a new video is added to a YouTube channel": "Exécute lorsqu'une nouvelle vidéo est ajoutée à une chaîne YouTube",
"Channel ID, URL, or handle": "ID de canal, URL, ou handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "Identifiant de la chaîne YouTube, URL ou gestion (par exemple: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,24 @@
{
"YouTube": "YouTube",
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,24 @@
{
"YouTube": "YouTube",
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "好きな動画や音楽を楽しんで、オリジナルのコンテンツをアップロードし、友人や家族、そして世界と共有しましょう。",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "カスタムAPI通話",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭",
"New Video In Channel": "チャンネル内の新しいビデオ",
"Runs when a new video is added to a YouTube channel": "YouTubeチャンネルに新しいビデオが追加されたときに実行されます。",
"Channel ID, URL, or handle": "チャンネル ID、URL、または指示先",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTubeチャンネルのID、URL、ハンドル@DutchPilotGirl"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Geniet van de video's en muziek waar je van houdt, upload originele inhoud, en deel ze allemaal met vrienden, familie en de wereld op YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Log in op [Google Cloud Console](https://console.cloud.google.com/).\n 2. Maak een nieuw project aan of gebruik een bestaand project.\n 3. Ga naar **API's & Services** en klik op **API's & Service inschakelen**.\n 4. Zoek naar **YouTube API** in de zoekbalk en schakel het in.\n 5. Ga naar het **OAuth toestemming scherm** en selecteer **External** type en klik op maken.\n 6. Vul de App Naam, Gebruikers Support E-mail en Ontwikkelaar Contact Informatie in. Klik op Opslaan en doorgaan knop.\n 7. Klik op **Voeg toe of verwijder Scopes** en voeg de volgende scopes toe en klik op bijwerken.\n - https://www.googleapis.com/auth/youtube\n - https://www. oogleapis.com/auth/youtube.readonly\n - https://www. oogleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube. orce-ssl\n 8. Klik op Opslaan en Doorgaan om de Scopes stap af te maken.\n 9. Klik op de knop Gebruikers toevoegen en voeg een test e-mail toe. U kunt uw eigen e-mail toevoegen). hen klik eindelijk op Opslaan en ga verder om de test users portie te voltooien.\n 10. Ga naar **Aanmeldingen**. Klik op de knop **Credentials** en selecteer de optie **OAuth client ID**.\n 11. Selecteer het applicatie type als **Web Applicatie** en vul het veld Naam in.\n 12. Voeg https://cloud.activepieces.com/redirect toe in **Authorized redirect URI's** veld, en klik op de Creëer-knop.\n 13. Kopieer **Client ID** en **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD",
"New Video In Channel": "Nieuwe Video In Kanaal",
"Runs when a new video is added to a YouTube channel": "Voert uit wanneer een nieuwe video wordt toegevoegd aan een YouTube kanaal",
"Channel ID, URL, or handle": "Kanaal ID, URL of handvat",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube kanaal ID, URL of handgreep (bijv. @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Aproveite os vídeos e músicas que você ama, carregue conteúdo original e compartilhe tudo com amigos, família e mundo no YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Entre no [Google Cloud Console](https://console.cloud.google.com/).\n 2. Crie um novo projeto ou você pode usar o existente.\n 3. Vá para **APIs & serviços** e clique em **Habilitar APIs e serviços**.\n 4. Procure por **API do YouTube** na barra de pesquisa e habilite-o.\n 5. Vá para **OAuth consent screen** e selecione o tipo **externo** e clique em criar.\n 6. Preencha o nome do aplicativo, e-mail de suporte do usuário e informações de contato do desenvolvedor. Clique no botão Salvar e Continuar.\n 7. Clique em **Adicionar ou Remover Escopos** e adicione os seguintes escopos e clique em atualizar.\n - https://www.googleapis.com/auth/youtube\n - https://www. oogleapis.com/auth/youtube.readonly\n - https://www. oogleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube. orce-ssl\n 8. Clique em Salvar e Continuar para terminar a etapa de escopos.\n 9. Clique no botão Adicionar Usuários e adicione um e-mail de teste. Você pode adicionar seu próprio e-mail). hen finalmente clique em Salvar e Continuar para terminar a porção de Usuários Teste de\n 10. Vá para **Credenciais**. Clique no botão **Criar Credenciais** e selecione a opção **ID do cliente OAuth.\n 11. Selecione o tipo de aplicativo como **Aplicativo Web** e preencha o campo Nome.\n 12. Adicionar https://cloud.activepieces.com/redirect no campo **URI de redirecionamento autorizado** e clique no botão Criar.\n 13. Copie o **ID do cliente** e o **Segredo do Cliente**.",
"Custom API Call": "Chamada de API personalizada",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA",
"New Video In Channel": "Novo vídeo no canal",
"Runs when a new video is added to a YouTube channel": "Executa quando um novo vídeo é adicionado a um canal do YouTube",
"Channel ID, URL, or handle": "ID do canal, URL ou identificador",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "ID do canal YouTube, URL ou identificador (ex.: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,24 @@
{
"YouTube": "YouTube",
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Наслаждайтесь видео и музыкой, которую вы любите, загружать оригинальный контент и делиться им с друзьями, семьей и миром на YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Пользовательский вызов API",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD",
"New Video In Channel": "Новое видео в канале",
"Runs when a new video is added to a YouTube channel": "Запускается при добавлении нового видео в канал YouTube",
"Channel ID, URL, or handle": "ID канала, URL или ручка",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "ID канала, URL или ручка YouTube (например, @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,24 @@
{
"YouTube": "YouTube",
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "Custom API Call",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,25 @@
{
"Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube",
"\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes": "\n 1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).\n 2. Create a new project or you can use existing one.\n 3. Go to **APIs & Services** and click **Enable APIs & Services**.\n 4. Search for **YouTube API** in the search bar and enable it.\n 5. Go to **OAuth consent screen** and select **External** type and click create.\n 6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.\n 7. Click on **Add or Remove Scopes** and add following scopes and click update.\n - https://www.googleapis.com/auth/youtube\n - https://www.googleapis.com/auth/youtube.readonly\n - https://www.googleapis.com/auth/youtube.upload\t\n - https://www.googleapis.com/auth/youtube.force-ssl\n 8. Click Save and Continue to finish the Scopes step.\n 9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.\n 10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.\n 11. Select the application type as **Web Application** and fill the Name field.\n 12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.\n 13. Copy **Client ID** and **Client Secret**.",
"Custom API Call": "自定义 API 呼叫",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色",
"New Video In Channel": "New Video In Channel",
"Runs when a new video is added to a YouTube channel": "Runs when a new video is added to a YouTube channel",
"Channel ID, URL, or handle": "Channel ID, URL, or handle",
"YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)": "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)"
}

View File

@@ -0,0 +1,30 @@
import {
createPiece,
OAuth2PropertyValue,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { youtubeNewVideoTrigger } from './lib/triggers/new-video.trigger';
import { youtubeAuth } from './lib/common/auth';
import { createCustomApiCallAction } from '@activepieces/pieces-common';
export const youtube = createPiece({
displayName: 'YouTube',
description:
'Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube',
minimumSupportedRelease: '0.33.0',
logoUrl: 'https://cdn.activepieces.com/pieces/youtube.png',
categories: [PieceCategory.CONTENT_AND_FILES],
auth: youtubeAuth,
authors: ['abaza738', 'kishanprmr', 'khaledmashaly', 'abuaboud'],
actions: [
createCustomApiCallAction({
baseUrl: () => 'https://www.googleapis.com/youtube/v3',
auth: youtubeAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [youtubeNewVideoTrigger],
});

View File

@@ -0,0 +1,32 @@
import { PieceAuth } from '@activepieces/pieces-framework';
export const youtubeAuth = PieceAuth.OAuth2({
description: `
1. Sign in to [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project or you can use existing one.
3. Go to **APIs & Services** and click **Enable APIs & Services**.
4. Search for **YouTube API** in the search bar and enable it.
5. Go to **OAuth consent screen** and select **External** type and click create.
6. Fill App Name, User Support Email, and Developer Contact Information. Click on the Save and Continue button.
7. Click on **Add or Remove Scopes** and add following scopes and click update.
- https://www.googleapis.com/auth/youtube
- https://www.googleapis.com/auth/youtube.readonly
- https://www.googleapis.com/auth/youtube.upload
- https://www.googleapis.com/auth/youtube.force-ssl
8. Click Save and Continue to finish the Scopes step.
9. Click on the Add Users button and add a test email You can add your own email).Then finally click Save and Continue to finish the Test Users portion.
10. Go to **Credentials**. Click on the **Create Credentials** button and select the **OAuth client ID** option.
11. Select the application type as **Web Application** and fill the Name field.
12. Add https://cloud.activepieces.com/redirect in **Authorized redirect URIs** field, and click on the Create button.
13. Copy **Client ID** and **Client Secret**.`,
authUrl: 'https://accounts.google.com/o/oauth2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
required: true,
scope: [
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtube.readonly',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtube.force-ssl'
],
});

View File

@@ -0,0 +1,7 @@
import { Property } from '@activepieces/pieces-framework';
export const channelIdentifier = Property.ShortText({
displayName: 'Channel ID, URL, or handle',
description: "YouTube channel's ID, URL, or handle (e.g: @DutchPilotGirl)",
required: true,
});

View File

@@ -0,0 +1,347 @@
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { channelIdentifier } from '../common/props';
import dayjs from 'dayjs';
import cheerio from 'cheerio';
import FeedParser from 'feedparser';
import axios from 'axios';
export const youtubeNewVideoTrigger = createTrigger({
name: 'new-video',
displayName: 'New Video In Channel',
description: 'Runs when a new video is added to a YouTube channel',
type: TriggerStrategy.POLLING,
requireAuth: false,
props: {
channel_identifier: channelIdentifier,
},
sampleData: {
title: 'Ap Flow Branching',
description: null,
summary: null,
date: '2023-03-09T01:23:10.000Z',
pubdate: '2023-03-01T21:31:36.000Z',
pubDate: '2023-03-01T21:31:36.000Z',
link: 'https://www.youtube.com/watch?v=C7MZkWxrtvM',
guid: 'yt:video:C7MZkWxrtvM',
author: 'Mohammad AbuAboud',
comments: null,
origlink: null,
image: {
url: 'https://i4.ytimg.com/vi/C7MZkWxrtvM/hqdefault.jpg',
},
source: {},
categories: [],
enclosures: [],
'atom:@': {},
'atom:id': {
'@': {},
'#': 'yt:video:C7MZkWxrtvM',
},
'yt:videoid': {
'@': {},
'#': 'C7MZkWxrtvM',
},
'yt:channelid': {
'@': {},
'#': 'UCgImnA993V_2IbQ9seYNEzA',
},
'atom:title': {
'@': {},
'#': 'Ap Flow Branching',
},
'atom:link': {
'@': {
rel: 'alternate',
href: 'https://www.youtube.com/watch?v=C7MZkWxrtvM',
},
},
'atom:author': {
'@': {},
name: {
'@': {},
'#': 'Mohammad AbuAboud',
},
uri: {
'@': {},
'#': 'https://www.youtube.com/channel/UCgImnA993V_2IbQ9seYNEzA',
},
},
'atom:published': {
'@': {},
'#': '2023-03-01T21:31:36+00:00',
},
'atom:updated': {
'@': {},
'#': '2023-03-09T01:23:10+00:00',
},
'media:group': {
'@': {},
'media:title': {
'@': {},
'#': 'Ap Flow Branching',
},
'media:content': {
'@': {
url: 'https://www.youtube.com/v/C7MZkWxrtvM?version=3',
type: 'application/x-shockwave-flash',
width: '640',
height: '390',
},
},
'media:thumbnail': {
'@': {
url: 'https://i4.ytimg.com/vi/C7MZkWxrtvM/hqdefault.jpg',
width: '480',
height: '360',
},
},
'media:description': {
'@': {},
},
'media:community': {
'@': {},
'media:starrating': {
'@': {
count: '0',
average: '0.00',
min: '1',
max: '5',
},
},
'media:statistics': {
'@': {
views: '9',
},
},
},
},
meta: {
'#ns': [
{
'xmlns:yt': 'http://www.youtube.com/xml/schemas/2015',
},
{
'xmlns:media': 'http://search.yahoo.com/mrss/',
},
{
xmlns: 'http://www.w3.org/2005/Atom',
},
],
'@': [
{
'xmlns:yt': 'http://www.youtube.com/xml/schemas/2015',
},
{
'xmlns:media': 'http://search.yahoo.com/mrss/',
},
{
xmlns: 'http://www.w3.org/2005/Atom',
},
],
'#xml': {
version: '1.0',
encoding: 'UTF-8',
},
'#type': 'atom',
'#version': '1.0',
title: 'Mohammad AbuAboud',
description: null,
date: '2020-12-29T17:29:29.000Z',
pubdate: '2020-12-29T17:29:29.000Z',
pubDate: '2020-12-29T17:29:29.000Z',
link: 'https://www.youtube.com/channel/UCgImnA993V_2IbQ9seYNEzA',
xmlurl:
'http://www.youtube.com/feeds/videos.xml?channel_id=UCgImnA993V_2IbQ9seYNEzA',
xmlUrl:
'http://www.youtube.com/feeds/videos.xml?channel_id=UCgImnA993V_2IbQ9seYNEzA',
author: 'Mohammad AbuAboud',
language: null,
favicon: null,
copyright: null,
generator: null,
cloud: {},
image: {},
categories: [],
'atom:@': {
'xmlns:yt': 'http://www.youtube.com/xml/schemas/2015',
'xmlns:media': 'http://search.yahoo.com/mrss/',
xmlns: 'http://www.w3.org/2005/Atom',
},
'atom:link': [
{
'@': {
rel: 'self',
href: 'http://www.youtube.com/feeds/videos.xml?channel_id=UCgImnA993V_2IbQ9seYNEzA',
},
},
{
'@': {
rel: 'alternate',
href: 'https://www.youtube.com/channel/UCgImnA993V_2IbQ9seYNEzA',
},
},
],
'atom:id': {
'@': {},
'#': 'yt:channel:',
},
'yt:channelid': {
'@': {},
},
'atom:title': {
'@': {},
'#': 'Mohammad AbuAboud',
},
'atom:author': {
'@': {},
name: {
'@': {},
'#': 'Mohammad AbuAboud',
},
uri: {
'@': {},
'#': 'https://www.youtube.com/channel/UCgImnA993V_2IbQ9seYNEzA',
},
},
'atom:published': {
'@': {},
'#': '2020-12-29T17:29:29+00:00',
},
},
},
async test({ propsValue }): Promise<unknown[]> {
const channelId = await getChannelId(propsValue.channel_identifier);
if (!channelId) {
return [];
}
return (await getRssItems(channelId)) || [];
},
async onEnable({ propsValue, store }): Promise<void> {
const channelId = await getChannelId(propsValue.channel_identifier);
if (!channelId) {
throw new Error('Unable to get channel ID.');
}
await store.put('channelId', channelId);
const items = (await getRssItems(channelId)) || [];
await store.put('lastFetchedYoutubeVideo', items?.[0]?.guid);
await store.put('lastUpdatedYoutubeVideo', getUpdateDate(items?.[0]));
return;
},
async onDisable(): Promise<void> {
return;
},
async run({ store }): Promise<unknown[]> {
const channelId = await store.get<string>('channelId');
if (!channelId) return [];
const items = (await getRssItems(channelId)) || [];
if (items.length === 0) {
return [];
}
const lastItemId = await store.get('lastFetchedYoutubeVideo');
const storedLastUpdated = await store.get<string>(
'lastUpdatedYoutubeVideo'
);
/**
* If the new latest item's date is before the last saved date
* it means something got deleted, nothing else to do
* this happens when a live stream ends, the live stream entry is deleted and later
* is replaced by the stream's video.
*/
if (
storedLastUpdated &&
dayjs(getUpdateDate(items?.[0])).isBefore(dayjs(storedLastUpdated))
) {
return [];
}
const newItems = [];
for (const item of items) {
if (item.guid === lastItemId) break;
if (
storedLastUpdated &&
dayjs(getUpdateDate(item)).isBefore(dayjs(storedLastUpdated))
) {
continue;
}
newItems.push(item);
}
await store.put('lastFetchedYoutubeVideo', items?.[0]?.guid);
await store.put('lastUpdatedYoutubeVideo', getUpdateDate(items?.[0]));
return newItems;
},
});
function getUpdateDate(item: any) {
const updated = item['atom:updated'];
if (updated == undefined) {
return undefined;
}
return updated['#'];
}
async function getChannelId(urlOrId: string) {
if (urlOrId.trim().startsWith('@')) {
urlOrId = 'https://www.youtube.com/' + urlOrId;
}
if (!urlOrId.includes('https')) {
return urlOrId;
}
const response = await httpClient.sendRequest<any>({
method: HttpMethod.GET,
url: urlOrId,
});
const $ = cheerio.load(response.body);
// Check if the URL is a channel ID itself
const channelUrl = $('link[rel="canonical"]').attr('href');
if (channelUrl && channelUrl.includes('/channel/')) {
return channelUrl.split('/channel/')[1];
}
throw new Error('Invalid YouTube channel URL');
}
function getRssItems(channelId: string): Promise<any[]> {
const url = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`;
return new Promise((resolve, reject) => {
axios
.get(url, {
responseType: 'stream',
})
.then((response) => {
const feedparser = new FeedParser({
addmeta: true,
});
response.data.pipe(feedparser);
const items: any[] = [];
feedparser.on('readable', () => {
let item = feedparser.read();
while (item) {
items.push(item);
item = feedparser.read();
}
});
feedparser.on('end', () => {
resolve(items.reverse());
});
feedparser.on('error', (error: any) => {
reject(error);
});
})
.catch((error) => {
reject(error);
});
});
}

View File

@@ -0,0 +1,16 @@
{
"extends": "../../../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}

View File

@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}