YouTube Board

外部資料擷取狀態

追蹤會跟 YouTube Data API、comment API、tag.analysis.tw 等外部來源要資料,或支援資料擷取管線的排程工作。

外部資料擷取

13 jobs 13 active 13 command-ready
13 排程可執行 0 排程預覽 / request 渲染 0 使用者請求才執行

追蹤會跟 YouTube Data API、comment API、tag.analysis.tw 等外部來源要資料,或支援資料擷取管線的排程工作。

Runtime Gates

scheduler enabled local polling enabled 13 scheduled allowed 0 scheduled blocked
external scheduler active window 3 minutes

latest=2026-06-10 18:39:01 Asia/Taipei executed=2 failed=0

global 34 jobs allowlist 28 timezone Asia/Taipei dry-run php artisan ingestion:run

Live polling

Priority Status Trigger Modern command Scheduled status Legacy command Schedule Dependency Writes Notes
1 active ready 排程可執行 youtube:live:cleanup
youtube.live.cleanup
detail / next runs
allowed
youtube:live:cleanup --execute --limit=100
/usr/bin/php /home/urtube/maint/unlist_live.php 27 */2 * * *
每 2 小時第 27 分
Local DB
preview mode; scheduled/local --execute marks stale urt_video_live.del_flag=1
Legacy 會把過久未更新、尚未結束且排程時間已過的 urt_video_live row 設為 del_flag=1;modern command 的 preview mode 會列出 would-mark rows。Explicit/scheduled --execute 會限量更新本機 del_flag;這個 cleanup job 使用本地資料。
1 active ready 排程可執行 youtube:live:poll
youtube.live.poll
detail / next runs
allowed
youtube:live:poll --execute --limit=50
/usr/bin/php /home/urtube/maint/get_live.php * * * * *
每分鐘
Local DB
dashboard-safe live polling preview; scheduled/local --execute updates live rows and live logs
Legacy 從 urt_video_livemtime 超過 interval、尚未結束、排程時間已到且未刪除的直播 row;少於 10 筆且未指定 videoId 時會直接離開,否則呼叫 YouTube videos.list(liveStreamingDetails) 更新 urt_video_live 並 upsert urt_video_live_log.log_json。Modern command 的 preview mode 會列出 would-poll rows;explicit/scheduled --execute --videoId/--limit 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally 更新本機 urt_video_liveurt_video_live_log。Scheduler 在 scheduled-write gates 允許時使用 scheduled execute command;關閉時不執行 capped command。
1 active ready 排程可執行 youtube:tvbs:live:poll
youtube.tvbs.live.poll
detail / next runs
allowed
youtube:tvbs:live:poll --execute --limit=20
/usr/bin/php /home/urtube/maint/get_live_tvbs.php * * * * *
每分鐘 ingestion preview;legacy file 本身是 while(1) + sleep(30),未列在目前 cron snapshot
Local DB
preview mode; scheduled/local --execute updates urt_video_live_tvbs and urt_video_live_log_tvbs
Legacy TVBS poller 從 urt_video_live_tvbsmtime 超過硬編碼 40 秒、尚未結束、排程時間已到且未刪除的直播 row,呼叫 YouTube videos.list(liveStreamingDetails) 後更新 urt_video_live_tvbs 並 upsert urt_video_live_log_tvbs.log_json。這支是 standalone while-loop,未列在目前 production crontab;Modern command 的 preview mode 會列出 would-poll rows;manual/scheduled --execute --videoId/--limit 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally 更新本機 urt_video_live_tvbsurt_video_live_log_tvbs。Scheduler 在 scheduled-write gates 允許時使用 capped scheduled execute command;關閉時不執行 capped command。videoId branch 在 legacy source 意外查 urt_video_live,modern implementation 保持 TVBS table scope 並記錄 compatibility note。

Video discovery

Priority Status Trigger Modern command Scheduled status Legacy command Schedule Dependency Writes Notes
2 active ready 排程可執行 youtube:channels:videos
youtube.channels.videos.general
detail / next runs
allowed
youtube:channels:videos --execute --limit=5 --max-results=3
/usr/bin/php /home/urtube/maint/get_video.php */5 * * * *
每 5 分鐘
Local DB
preview mode; scheduled/local --execute inserts videos/schedules/live rows
Legacy 會挑 urt_channel.vtime 到期或 NULL 的頻道,先把 vtime 推到一小時後,再呼叫 YouTube playlistItems.list(snippet) 抓 uploads playlist,insert urt_videourt_video_schedule,live/upcoming 時 insert urt_video_live,最後依近七天影片數估算下一次 vtime。Modern command 的 preview mode 會列出 would-fetch channels 和本地估算;explicit/scheduled --execute --id/--channel --limit --max-results 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,idempotently upsert 本機 urt_videourt_video_scheduleurt_video_live 並更新 urt_channel.vtime。Scheduler 在 scheduled-write gates 允許時使用 scheduled execute command;單一 playlist API 失敗會跳過該 channel 並延後重試,避免整個 job 卡死。
2 active ready 排程可執行 youtube:channels:videos --live=1 --force=3
youtube.channels.videos.live
detail / next runs
allowed
youtube:channels:videos --live=1 --force=3 --execute --limit=3 --max-results=5
/usr/bin/php /home/urtube/maint/get_video.php live=1 force=3 5 2-16 * * *
02-16 點每小時第 5 分
Local DB
preview mode; scheduled/local --execute inserts videos/schedules/live rows
Legacy 會從 urt_count.tags[52] 直播頻道,呼叫 YouTube playlistItems.list(snippet) 抓 uploads playlist,insert urt_videourt_video_schedule,並在 live/upcoming 時 insert urt_video_live。Modern command 的 preview mode 會列出 would-fetch channels;explicit/scheduled --execute --id/--channel --limit --max-results 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,idempotently upsert 本機 urt_videourt_video_scheduleurt_video_live 並更新 urt_channel.vtime。Scheduler 在 scheduled-write gates 允許時使用 scheduled execute command;關閉時不執行 capped command。
2 active ready 排程可執行 youtube:channels:videos --live=2 --force=3
youtube.channels.videos.live_group
detail / next runs
allowed
youtube:channels:videos --live=2 --force=3 --execute --limit=3 --max-results=5
/usr/bin/php /home/urtube/maint/get_video.php live=2 force=3 1,31 0-15 * * *
00-15 點每小時第 1、31 分
Local DB
preview mode; scheduled/local --execute inserts videos/schedules/live rows
Legacy 會從 urt_count.tags[89] 群組頻道,呼叫 YouTube playlistItems.list(snippet) 抓 uploads playlist,insert urt_videourt_video_schedule,並在 live/upcoming 時 insert urt_video_live。Modern command 的 preview mode 會列出 would-fetch channels;explicit/scheduled --execute --id/--channel --limit --max-results 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,idempotently upsert 本機 urt_videourt_video_scheduleurt_video_live 並更新 urt_channel.vtime。Scheduler 在 scheduled-write gates 允許時使用 scheduled execute command;關閉時不執行 capped command。
2 active ready 排程可執行 youtube:tag-videos:backfill
youtube.tag_videos.backfill
detail / next runs
allowed
youtube:tag-videos:backfill --tagid=102 --days=2 --execute --limit=100 --max-pages=20 --max-results=50
/usr/bin/php /home/urtube/maint/get_video.php tagid=102 plus make_tag_date.php 17 0,3,6,9,12,15,18,21 * * *
每日 8 次;分頁抓 tag 頻道 uploads playlist 後重建逐日快取
YouTube Data API + Local DB
preview mode; scheduled/local --execute upserts urt_video, urt_video_schedule, urt_video_live, and urt_show_tag_date
針對每日新聞頻道等高產量 tag,不能只靠一般 discovery 每頻道少量 playlist item。此 job 依 urt_count.tags 找指定 tag 全部頻道,分頁抓 uploads playlist 直到超出日期範圍,寫入影片資料後用 TagDateCacheBuilder 重建 urt_show_tag_date,讓 /tags/{tagId}/days 使用本機每日快取。
2 active ready 排程可執行 youtube:tvbs:videos
youtube.tvbs.videos
detail / next runs
allowed
youtube:tvbs:videos --execute --limit=1 --max-results=1
/usr/bin/php /home/urtube/maint/get_video_tvbs.php */5 * * * *
每 5 分鐘 ingestion preview;legacy file 本身是 while loop + sleep(300),未列在目前 cron snapshot
Local DB
preview mode; scheduled/local --execute inserts videos/schedules/TVBS live rows
Legacy TVBS discovery 從 urt_count.tags[29] 頻道,逐一呼叫 YouTube playlistItems.list(snippet) 抓 uploads playlist,insert urt_videourt_video_schedule,並在縮圖含 default_live.jpg 或 live/upcoming 時 insert urt_video_live_tvbs。這支是 standalone while-loop,未列在目前 production crontab;Modern command 的 preview mode 會列出 would-fetch channels;manual/scheduled --execute --id/--channel --limit --max-results 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,idempotently upsert 本機 urt_video / urt_video_schedule / urt_video_live_tvbs。Scheduler 在 scheduled-write gates 允許時使用 capped scheduled execute command;關閉時不執行 capped command。

Video polling

Priority Status Trigger Modern command Scheduled status Legacy command Schedule Dependency Writes Notes
2 active ready 排程可執行 youtube:videos:stats
youtube.videos.stats
detail / next runs
allowed
youtube:videos:stats --execute --limit=25
/usr/bin/php /home/urtube/maint/get_video_count.php */7 0-17 * * *
00-17 點每 7 分鐘
Local DB
preview mode; scheduled/local --execute updates video stats/log rows
Legacy 從 urt_video_schedulestime 到期且 210 天內發布的影片,先把 stime 推到未來,再呼叫 YouTube videos.list(statistics) 並更新 urt_videourt_video_scheduleurt_video_logurt_video_log_history。Modern command 的 preview mode 會列出 would-refresh candidates;explicit/scheduled --execute --videoId/--limit 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally/idempotently upsert 本機 stats/log rows。Scheduler 在 scheduled-write gates 允許時使用 capped scheduled execute command;關閉時不執行 capped command。
3 active ready 排程可執行 youtube:videos:duration
youtube.videos.duration
detail / next runs
allowed
youtube:videos:duration --execute --limit=25 --enqueue-missing
/usr/bin/php /home/urtube/maint/get_duration.php */23 * * * *
每 23 分鐘
Local DB
preview mode; scheduled/local --execute updates duration queue rows
Legacy 從 urt_video_duration queue 挑 mtime/duration/stime 皆為 NULL 的 row,先把 stime 推到未來,再呼叫 YouTube videos.list(contentDetails) 並更新 duration/caption。Modern command 的 preview mode 會列出 queue candidates 和 missing queue diagnostics;explicit/scheduled --execute --videoId/--limit 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally/idempotently 更新本機 urt_video_duration--enqueue-missing 可從既有本機 urt_video 補缺少 duration row 的影片;未指定 --videoId 時會補一批最近影片,讓 scheduler 不會因空 queue 而空跑。Scheduler 在 scheduled-write gates 允許時使用 capped scheduled execute command;關閉時不執行 capped command。

YouTube polling

Priority Status Trigger Modern command Scheduled status Legacy command Schedule Dependency Writes Notes
2 active ready 排程可執行 youtube:channels:stats
youtube.channels.stats
detail / next runs
allowed
youtube:channels:stats --execute --limit=25
/usr/bin/php /home/urtube/maint/get_statics.php */9 * * * *
每 9 分鐘
Local DB
preview mode; scheduled/local --execute updates channel/count/log rows
Legacy 從 urt_channelstime 過期或 NULL 的頻道,23 點只補 NULL,先更新 urt_channel.stime,再呼叫 YouTube channels.list(statistics) 並更新 urt_logurt_counturt_channel。Modern command 的 preview mode 會列出 would-refresh channels;explicit/scheduled --execute --u_id/--channel --limit 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally/idempotently 更新本機 urt_channelurt_counturt_log。Scheduler 在 scheduled-write gates 允許時使用 capped scheduled execute command;關閉時不執行 capped command。

Comments

Priority Status Trigger Modern command Scheduled status Legacy command Schedule Dependency Writes Notes
5 active ready 排程可執行 youtube:comments:fetch
youtube.comments.fetch
detail / next runs
allowed
youtube:comments:fetch --execute --limit=5 --max-pages=1
/usr/bin/php /home/urtube/maint/do_comments.php 5 * * * *
每小時第 5 分
Local DB; YouTube Data API commentThreads.list only with explicit/scheduled `--execute`
preview mode; scheduled/local --execute updates comments/authors/revisions and moves queue rows
Legacy 逐筆讀 urt_comment_queue,先更新 stime,呼叫 maint/get_comment.php videoId=... 抓 YouTube commentThreads.list 並更新 urt_comment / urt_comment_author / urt_comment_rev,再更新 ftime、copy 到 urt_comment_queue_done、delete queue row。Production crontab 只在每小時第 5 分排程。Modern command 的 preview mode 會列出 would-drain rows 和三小時快取判斷;explicit/scheduled --execute --videoId/--limit --max-pages 會檢查 YOUTUBE_API_KEY 後限量呼叫 YouTube,transactionally 更新本機 comment/author/revision tables 並搬移 queue row。Scheduler 在 scheduled-write gates 允許時用 capped execute command 消化 queue。
5 active ready 排程可執行 youtube:comments:queue --or=1,2,3,4,5,6,13,14,81 --hours=72 --min=500
youtube.comments.queue
detail / next runs
allowed
youtube:comments:queue --or=1,2,3,4,5,6,13,14,81 --hours=72 --min=500 --execute --limit=5
/usr/bin/php /home/urtube/maint/make_comments.php or=1,2,3,4,5,6,13,14,81 hours=72 min=500 23 4,10,16 * * *
04、10、16 點第 23 分
Local DB
preview mode; scheduled/local --execute inserts urt_comment_queue
Legacy 會用 urt_count.tags 篩頻道,再找 urt_video.publishedAt 在指定 hours 內且 viewCount/commentCount 都超過 min 的影片,若不在 urt_comment_queue 就 insert queue row。Production crontab 使用 hours=72 min=500 且只在 04/10/16 點第 23 分排程。Modern command 的 preview mode 會列出 would-queue videos;explicit/scheduled --execute --limit 會 idempotently 插入本機 urt_comment_queue。Scheduler 在 scheduled-write gates 允許時用 capped execute command 補 queue rows。