兩邊的前次修訂版前次修改
下次修改 | 前次修改
|
工具:youtuberss [2019/07/22 18:46] – l | 工具:youtuberss [2019/07/22 18:52] (目前版本) – l |
---|
===== 規則範例 ===== | ===== 任何 YouTube 頻道變成 RSS 的規則範例 ===== |
| |
| ==== 例如 ==== |
| |
* https://www.youtube.com/channel/UCXXHhxHgPj_QXAqLxrepC4g | * https://www.youtube.com/channel/UCXXHhxHgPj_QXAqLxrepC4g |
| |
==== 得到 ==== | ==== 可以得到 ==== |
| |
* 頻道 RSS = \\ https://www.youtube.com/feeds/videos.xml?channel_id=UCXXHhxHgPj_QXAqLxrepC4g | * 整個頻道 RSS = \\ https://www.youtube.com/feeds/videos.xml?channel_id=UCXXHhxHgPj_QXAqLxrepC4g |
* 整個頻道視為一個播放清單的 RSS = \\ https://www.youtube.com/feeds/videos.xml?playlist_id=UUXXHhxHgPj_QXAqLxrepC4g | * 整個頻道視為一個播放清單的 RSS = \\ https://www.youtube.com/feeds/videos.xml?playlist_id=UUXXHhxHgPj_QXAqLxrepC4g |
* 輪播的 embed target url = \\ https://www.youtube.com/embed/videoseries?list=UUXXHhxHgPj_QXAqLxrepC4g&index=0&loop=1&autoplay=1 | * 輪播的 embed target url = \\ https://www.youtube.com/embed/videoseries?list=UUXXHhxHgPj_QXAqLxrepC4g&index=0&loop=1&autoplay=1 |
* 輪播 embed url 等同於 \\ https://www.youtube.com/embed/?listType=playlist&list=UUXXHhxHgPj_QXAqLxrepC4g&index=0&loop=1&autoplay=1 | * 輪播 embed url 等同於 \\ https://www.youtube.com/embed/?listType=playlist&list=UUXXHhxHgPj_QXAqLxrepC4g&index=0&loop=1&autoplay=1 |
| * 這四種方式,上面兩個有同樣效果,下面兩個也有同樣效果。 |
| |
---- | ---- |
* 於 https://www.youtube.com/channel/xxxx 畫面下,使用:\\ <code> | * 於 https://www.youtube.com/channel/xxxx 畫面下,使用:\\ <code> |
javascript:function copy(s) { var clip_area = document.createElement('textarea'); clip_area.textContent = s; document.body.appendChild(clip_area); clip_area.select(); document.execCommand('copy'); clip_area.remove(); } var regex_playlist = /https?:\/\/www.youtube.com\/([^\/\&]{1,})(&|\?)(p|list|playlist_id)=([^\/&]{1,})(.*)/gi; if(regex_playlist.test(document.location.href)){ var playlist_id = document.location.href.replace(regex_playlist,'$4'); copy('https://www.youtube.com/feeds/videos.xml?playlist_id=' + playlist_id); console.log('播放清單 RSS https://www.youtube.com/feeds/videos.xml?playlist_id=' + playlist_id); console.log('輪播的 embed target url = ' + 'https://www.youtube.com/embed/videoseries?list=' + playlist_id + '&index=0&loop=1&autoplay=1'); console.log('輪播 embed url 等同於 ' + 'https://www.youtube.com/embed/?listType=playlist&list=' + playlist_id + '&index=0&loop=1&autoplay=1'); }else{ var channel_id = ''; if(window["ytInitialData"].metadata!==undefined){ var channel_id = window["ytInitialData"].metadata.channelMetadataRenderer.externalId; document.location.href.replace(regex,'$1'); }else{ var regex = /https?:\/\/www.youtube.com\/channel\/([^\/]{1,})(\/.*|.*$)/gi; if(regex.test(document.location.href)){ channel_id = document.location.href.replace(regex,'$1'); } } if(channel_id!=''){ copy('https://www.youtube.com/feeds/videos.xml?channel_id=' + channel_id); console.log('頻道 RSS = https://www.youtube.com/feeds/videos.xml?channel_id=' + channel_id); console.log('整個頻道視為一個播放清單的 RSS https://www.youtube.com/feeds/videos.xml?playlist_id=' + channel_id.replace('UC','UU')); console.log('輪播的 embed target url = ' + 'https://www.youtube.com/embed/videoseries?list=' + channel_id.replace('UC','UU') + '&index=0&loop=1&autoplay=1'); console.log('輪播 embed url 等同於 ' + 'https://www.youtube.com/embed/?listType=playlist&list=' + channel_id.replace('UC','UU') + '&index=0&loop=1&autoplay=1'); }else{ if(/^https?:\/\/(.*\.youtube\.com\/watch\?v\=|youtu\.be\/)([^&|^?]*)($|\&.*$|\?.*$)/gi.test(document.location.href)){/*window.prompt('',*/copy(`<iframe width="560" height="315" src="` + document.location.href.replace(/^https?:\/\/(.*\.youtube\.com\/watch\?v\=|youtu\.be\/)([^&|^?]*)($|\&.*$|\?.*$)/gi,'https://www.youtube.com/embed/$2') + `" frameborder="0" allowfullscreen></iframe>`);} } }</code> | javascript:function copy(s) { var clip_area = document.createElement('textarea'); clip_area.textContent = s; document.body.appendChild(clip_area); clip_area.select(); document.execCommand('copy'); clip_area.remove(); } var regex_playlist = /https?:\/\/www.youtube.com\/([^\/\&]{1,})(&|\?)(p|list|playlist_id)=([^\/&]{1,})(.*)/gi; if(regex_playlist.test(document.location.href)){ var playlist_id = document.location.href.replace(regex_playlist,'$4'); copy('https://www.youtube.com/feeds/videos.xml?playlist_id=' + playlist_id); console.log('播放清單 RSS https://www.youtube.com/feeds/videos.xml?playlist_id=' + playlist_id); console.log('輪播的 embed target url = ' + 'https://www.youtube.com/embed/videoseries?list=' + playlist_id + '&index=0&loop=1&autoplay=1'); console.log('輪播 embed url 等同於 ' + 'https://www.youtube.com/embed/?listType=playlist&list=' + playlist_id + '&index=0&loop=1&autoplay=1'); }else{ var channel_id = ''; if(window["ytInitialData"].metadata!==undefined){ var channel_id = window["ytInitialData"].metadata.channelMetadataRenderer.externalId; document.location.href.replace(regex,'$1'); }else{ var regex = /https?:\/\/www.youtube.com\/channel\/([^\/]{1,})(\/.*|.*$)/gi; if(regex.test(document.location.href)){ channel_id = document.location.href.replace(regex,'$1'); } } if(channel_id!=''){ copy('https://www.youtube.com/feeds/videos.xml?channel_id=' + channel_id); console.log('頻道 RSS = https://www.youtube.com/feeds/videos.xml?channel_id=' + channel_id); console.log('整個頻道視為一個播放清單的 RSS https://www.youtube.com/feeds/videos.xml?playlist_id=' + channel_id.replace('UC','UU')); console.log('輪播的 embed target url = ' + 'https://www.youtube.com/embed/videoseries?list=' + channel_id.replace('UC','UU') + '&index=0&loop=1&autoplay=1'); console.log('輪播 embed url 等同於 ' + 'https://www.youtube.com/embed/?listType=playlist&list=' + channel_id.replace('UC','UU') + '&index=0&loop=1&autoplay=1'); }else{ if(/^https?:\/\/(.*\.youtube\.com\/watch\?v\=|youtu\.be\/)([^&|^?]*)($|\&.*$|\?.*$)/gi.test(document.location.href)){/*window.prompt('',*/copy(`<iframe width="560" height="315" src="` + document.location.href.replace(/^https?:\/\/(.*\.youtube\.com\/watch\?v\=|youtu\.be\/)([^&|^?]*)($|\&.*$|\?.*$)/gi,'https://www.youtube.com/embed/$2') + `" frameborder="0" allowfullscreen></iframe>`);} } }</code> |
| * 效果:\\ 直接自動複製 https://www.youtube.com/feeds/videos.xml?channel_id=UCXXXXXXXXX \\ 並在 console.log((Chrome + F12 並選擇「console」就可以看 console.log)) 留下其他的 RSS 網址。 |
| |
---- | ---- |