OutOfCycle

Fix and optimize YouTube playlist shuffle behavior

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
作者
RMT120430
1日のインストール数
0
累計インストール数
4
評価
0 0 0
バージョン
3.5.0
作成日
2026/04/28
更新日
2026/04/29
大きさ
16.2KB
ライセンス
MIT
対象サイト

# ![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/icon128.png?raw=true) OutOfCycle v3.5.0

---

## Purpose
Improve and fix YouTube playlist shuffle behavior by preventing duplicate plays and incomplete loading issues.

![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/Preview2.png?raw=true) ![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/Preview1.png?raw=true)

---

## Usage Notes

### Installation
1. Please install the **Tampermonkey** browser extension using the links provided to the browser extension store (note that not all browsers may be listed).
- Chrome: [Tampermonkey](https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)
- Firefox: [Tampermonkey](https://addons.mozilla.org/zh-TW/firefox/addon/tampermonkey/)
- Opera: [Tampermonkey](https://addons.opera.com/zh-tw/extensions/details/tampermonkey-beta/)
- Edge: [Tampermonkey](https://microsoftedge.microsoft.com/addons/detail/%E7%AF%A1%E6%94%B9%E7%8C%B4/iikmkjmpaadaobahmlepeloendndfphd)
- Safari: [Tampermonkey](https://apps.apple.com/br/app/tampermonkey-classic/id1482490089?l=en-GB&mt=12)

Note: This project was tested using Chrome. Compatibility with other browsers is not guaranteed.

2. Go to [GreasyFork](https://greatest.deepsurf.us/zh-TW/scripts/575787-outofcycle) and click “Install”
3. Ensure the **OutOfCycle** script is enabled in Tampermonkey

---

### Supported Pages
- Playlist pages only
https://www.youtube.com/playlist?list=*
- Click **START** on the playlist page
If clicked on a video watch page (`watch?v=*`), it will redirect to the playlist page automatically

---

### Playback Behavior
- Automatically switches to the next video **1.5 seconds before** the current one ends
(Reducing this time is not recommended due to loading delays)
- When revisiting the same playlist, press **NEXT/PREV** to continue the previous shuffle cycle
- To return to single-track repeat, press **STOP** to terminate the shuffle script

---

## Shuffle Logic

### Auto Loading & Detection
- Automatically scrolls to the bottom of the playlist to load all videos, and exclude Recommended videos from the playlist.
- Continuously checks loading status and starts shuffle playback once complete

### No Duplicate Playback
- Generates a full randomized queue
- Ensures no video is repeated within a single shuffle cycle
- Press **RESHUFFLE** to generate a new random order

### Completion Detection
1. **Video Count Match**
Loading is complete when the loaded video count matches the displayed total
2. **Last Element Check**
Designed for playlists containing hidden or deleted videos
If the last video element is the final item in the container, loading is considered complete

---

## Bug Reports & Support
- Please report issues via GitHub Issues
- Replies may use machine translation; thank you for your understanding

---

## Support the Author
- [Ko-fi](https://ko-fi.com/rmt120430)
- You are also welcome to visit my GitHub profile for more projects

---

# ![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/icon128.png?raw=true) OutOfCycle v3.5.0

---

## 專案目的
優化並修正 YouTube 播放清單的隨機播放行為,避免重複播放與載入不完整問題。

![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/Preview2.png?raw=true) ![image](https://github.com/RMT120430/RMTStation_OutOfCycle/blob/main/Preview1.png?raw=true)

---

## 使用注意事項

### 安裝步驟
1. 先安裝瀏覽器擴充套件 Tampermonkey竄改猴,這邊附上瀏覽器的商店連結(或許沒有詳盡列出每一種瀏覽器)
- Chrome: [Tampermonkey](https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)
- Firefox: [Tampermonkey](https://addons.mozilla.org/zh-TW/firefox/addon/tampermonkey/)
- Opera: [Tampermonkey](https://addons.opera.com/zh-tw/extensions/details/tampermonkey-beta/)
- Edge: [Tampermonkey](https://microsoftedge.microsoft.com/addons/detail/%E7%AF%A1%E6%94%B9%E7%8C%B4/iikmkjmpaadaobahmlepeloendndfphd)
- Safari: [Tampermonkey](https://apps.apple.com/br/app/tampermonkey-classic/id1482490089?l=en-GB&mt=12)

註:我測試使用的瀏覽器是Chrome,其他瀏覽器可能無法保證能100%運行順利

2. 前往 [GreasyFork](https://greatest.deepsurf.us/zh-TW/scripts/575787-outofcycle),點擊「安裝」
3. 確認 **OutOfCycle** 腳本已在 Tampermonkey 中啟用

---

### 適用頁面
- 僅適用於播放清單頁面
https://www.youtube.com/playlist?list=*
- 請在播放清單頁面點擊 **START**
若在播放頁面(`watch?v=*`)按下,會自動跳轉至清單頁面

---

### 播放機制說明
- 影片結束前 **1.5 秒** 會自動切換至下一首
(不建議縮短時間,避免因載入延遲導致腳本失效)
- 下次回到同一播放清單時,可按 **NEXT/PREV** 繼續上一次的隨機迴圈
- 若要回到單曲重播,請按 **STOP** 結束隨機播放腳本

---

## 隨機播放原理

### 自動載入與檢查
- 自動捲動清單頁面至底部,確保所有影片皆被載入,並且從播放清單內排除推薦影片
- 持續檢查載入狀態,完成後自動開始隨機播放

### 不重複隨機
- 產生完整的亂數播放佇列
- 確保單一播放迴圈中不會重複播放同一影片
- 點擊 **RESHUFFLE** 可重新生成新的隨機順序

### 載入完成判定條件
1. **影片數量比對**
當已載入數量等於顯示的總影片數,即判定完成
2. **最後影片元素檢查**
適用於清單中包含「已隱藏 / 已刪除」影片的情況
若最後一個影片元素為容器中的最後項目,即判定完成

---

## 問題回報與協助
- 請使用 GitHub Issues 回報問題
- 我會透過翻譯工具回覆,敬請見諒

---

## 支持作者
- [Ko-fi](https://ko-fi.com/rmt120430)
- 也歡迎造訪我的 GitHub 主頁,查看其他有趣的專案