Integrate YouTube Analytics into app.js#95
Conversation
…tions - Added `ImportAnalytics` function to `youtube/app.js` to fetch video analytics. - Updated YouTube OAuth scopes to include analytics permissions. - Scheduled analytics import to run daily and on startup. - Created Knex migration to add `estimatedMinutesWatched`, `averageViewDuration`, and `averageViewPercentage` to the `videos` table. - Fixed a variable scoping bug in the analytics import logic. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…dditional utilities into app.js - Consolidated logic from `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Integrated Socket.IO server on port 3006 to handle real-time YouTube data requests and OAuth flow. - Added comprehensive YouTube Analytics import for both channels and individual videos. - Created Knex migrations to add necessary analytics columns to `channel` and `videos` tables. - Fixed a pre-existing bug in the task queue callback. - Updated OAuth scopes to include all required permissions for analytics. - Scheduled periodic analytics imports via cron. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
- Integrated all functions from `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Implemented historical analytics tracking in new `channel_analytics_history` and `video_analytics_history` tables. - Updated Socket.IO handlers to return only the latest analytics data from the history tables. - Removed all obsolete scripts (`kwm.js`, `server.js`, `reg.js`, `test.js`) from the `youtube/` directory. - Added Knex migration for the new history tables. - Fixed pre-existing queue callback bug and refined OAuth flow. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
- Integrated `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Implemented `channel_analytics_history` and `video_analytics_history` tables for time-series tracking. - Updated Socket.IO handlers to return the latest data from the new history tables. - Restored the 14-day lookback period for analytics imports. - Removed obsolete files from the `youtube/` directory. - Added Knex migration for analytics history tables. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
…tion - Fully integrated all logic from `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Implemented `channel_analytics_history` and `video_analytics_history` tables for historical tracking. - Updated Socket.IO handlers to ensure all real-time fetched data (broadcasts, videos, tokens) is persisted in the database. - Added Socket.IO handlers to retrieve the latest analytics snapshot from the database history. - Removed redundant source files and updated `ecosystem.config.js` to remove the obsolete `SYTH-YT-API` service. - Created `youtube/SOCKET_SERVER.md` to document the Socket.IO interface. - Added comprehensive Knex migration for analytics history tables. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
…socket tokens - Merged `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Implemented `channel_analytics_history` and `video_analytics_history` for time-series tracking. - Added `youtube_socket_token` table and model to independently store Socket.IO OAuth credentials (supporting custom client IDs/secrets). - Unified task processing and cron jobs to run for all tokens from both storage sources. - Optimized cron job scheduling to prevent redundant registrations. - Removed obsolete services from `ecosystem.config.js`. - Added `youtube/SOCKET_SERVER.md` documentation. - Fixed several bugs including a crash loop in channel identification and undefined variables in task queues. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
…and flexible OAuth - Merged logic from `kwm.js`, `server.js`, `reg.js`, and `test.js` into `youtube/app.js`. - Implemented `channel_analytics_history` and `video_analytics_history` tables for time-series performance tracking. - Added `youtube_socket_token` table and model to support independent OAuth configurations with custom client IDs/secrets. - Refactored `startTokens` and cron scheduling to unify processing for all tokens across both storage sources. - Updated Socket.IO interface to serve the latest analytics snapshots and persist all real-time data. - Added Knex migrations and Objection models for all new tables. - Removed obsolete scripts and updated PM2 `ecosystem.config.js`. - Created `youtube/SOCKET_SERVER.md` for interface documentation. - Fixed several bugs including a token update crash loop and API parameter typos. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
… and documentation - Merged logic from `kwm.js`, `server.js`, `reg.js`, and `test.js` into a unified `youtube/app.js`. - Implemented `channel_analytics_history` and `video_analytics_history` tables for historical performance tracking. - Added `youtube_socket_token` for independent OAuth management with support for custom client IDs/secrets (no `user_id` required). - Integrated Socket.IO server on port 3006 with database persistence for all real-time events. - Created `youtube/SOCKET_SERVER.md` with interface documentation. - Unified import tasks and cron jobs to process tokens from both storage sources. - Fixed several bugs including crash loops, duplicate cron registrations, and lookback period constraints. - Removed obsolete services from `ecosystem.config.js` and deleted redundant source files. - Added all necessary Knex migrations and Objection.js models. Co-authored-by: Istani <4234606+Istani@users.noreply.github.com>
This change integrates the YouTube Analytics data import functionality (previously in
kwm.js) into the mainyoutube/app.jslogic. It also provides the necessary Knex migration to store the newly fetched analytics data (estimatedMinutesWatched,averageViewDuration, andaverageViewPercentage) in thevideostable.PR created automatically by Jules for task 4221834900465305294 started by @Istani