+Youtube
by
noromanba
2012-12-14 [2012/12/14 09:22:27]
Subscribe Youtube feed (Atom, RSS)
@@ -20,24 +20,26 @@
* @private
*/
var d = document;
-var userHome = '';
-var userElemnt = d.getElementById('watch-uploader-info');
-if (userElemnt) {
- userHome = d.getElementById('watch-uploader-info').childNodes[1].href;
- goSubscribe();
-}
-userElemnt = d.getElementById('playnav-curvideo-channel-name');
-if (userElemnt) {
- userHome = userHome.firstChild.href;
- goSubscribe();
+var userChannel = '';
+userChannel = d.getElementById('watch-uploader-info');
+userChannel = d.getElementById('playnav-curvideo-channel-name');
+
+if (userChannel) {
+ userChannel = userChannel.childNodes[1].href;
+ goSubscribe();
+} else {
+ prompt('Try Manual Input','UserName');
+ goSubscribe();
}
+
function goSubscribe() {
- var userName = userHome.replace(/http:\/\/www\.youtube\.com\/user\/(.*)/, '$1');
- var uiQuery = '?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile';
- var feed = 'http://gdata.youtube.com/feeds/base/users/' + encodeURIComponent(userName) + '/uploads';
+ var userName = userChannel.replace(/http:\/\/www\.youtube\.com\/user\/(.*)/, '$1');
+ var baseFeed = 'http://gdata.youtube.com/feeds/base/users/' + encodeURIComponent(userName) + '/uploads';
+ var uiQuery = '?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile';
- var readerPreview = 'http://google.com/reader/view/feed/';
- //location.href = readerPreview + feed;
- location.href = readerPreview + feed + uiQuery;
+ var readerPreview = 'http://google.com/reader/view/feed/';
+ if (confirm('Sucscribe?')) {
+ location.href = readerPreview + baseFeed + uiQuery;
+ }
}
/*
* @title +YR
* @description Subscribe Youtube Uploads.
* @include http://http://www.youtube.com/*
* @license MIT License
* @require
* @see http://let.hatelabo.jp/noromanba/let/gYC-yJnWtr6DNw
*
* [NOTES]
* Large Thumbnail ver.
* http://gdata.youtube.com/feeds/base/users/youtube/uploads
* Default Register from Browser
* http://gdata.youtube.com/feeds/base/users/youtube/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile
* Tiny Query ver.
* http://gdata.youtube.com/feeds/base/users/youtube/uploads?alt=rss&v=2&orderby=published
* Alternate Gateway
* http://www.youtube.com/rss/user/youtube/videos.rss
* Exepand Alt-GW. Order by Updated?
* http://gdata.youtube.com/feeds/base/users/youtube/uploads?orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2
* @private
*/
var d = document;
var userChannel = '';
userChannel = d.getElementById('watch-uploader-info');
userChannel = d.getElementById('playnav-curvideo-channel-name');
if (userChannel) {
userChannel = userChannel.childNodes[1].href;
goSubscribe();
} else {
prompt('Try Manual Input','UserName');
goSubscribe();
}
function goSubscribe() {
var userName = userChannel.replace(/http:\/\/www\.youtube\.com\/user\/(.*)/, '$1');
var baseFeed = 'http://gdata.youtube.com/feeds/base/users/' + encodeURIComponent(userName) + '/uploads';
var uiQuery = '?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile';
var readerPreview = 'http://google.com/reader/view/feed/';
if (confirm('Sucscribe?')) {
location.href = readerPreview + baseFeed + uiQuery;
}
}
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。