+Youtube
by
noromanba
2012-12-14 [2012/12/14 09:22:27]
Subscribe Youtube feed (Atom, RSS)
@@ -2,9 +2,9 @@
* @title +Subscribe Youtube RSS
* @description Subscribe Youtube Uploads RSS.
* @include http://http://www.youtube.com/*
- * @license MIT License
+ * @license MIT License http://www.opensource.org/licenses/MIT
* @require
- * @see http://let.hatelabo.jp/noromanba/let/gYC-yZeZ6_P0WQ
+ * @see http://let.hatelabo.jp/noromanba/let/gYC-yZeZ6_P0WQ (ParmaLink)
*
* [RSS]
* Large Thumbnail ver.
@@ -16,29 +16,30 @@
*
* Alternate Gateway
* http://www.youtube.com/rss/user/youtube/videos.rss
- * Exepand Alt-GW. Order by Updated?
+ * Exepand Alt-GW. Default Order by Updated
* http://gdata.youtube.com/feeds/base/users/youtube/uploads?orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2
*
* [NOTE]
- * Possibilities conflict Browser Extensions.
- * If you use 'Developer Tools' and it's stuck or death, try '--disable-extensions' option.
+ * This bookmarklet that may conflict with the browser extension.
+ * If you have problems while using the Developer Tool(It's stuck or death),
+ * please try to disable the extension.
+ * ex) GoogleChrome: '--disable-extensions'
*/
var d = document;
function $(q) { return d.querySelector(q); }
-(function() {
- if (getUserNameByLocation()) {
- return goSubscribe(getUserNameByLocation());
- }
- return goSubscribe(getUserNameBySelector());
-})(); void 0;
+void(
+ (function() {
+ if (getUserNameByLocation()) {
+ return goSubscribe(getUserNameByLocation());
+ }
+ return goSubscribe(getUserNameBySelector());
+ })()
+);
function getUserNameByLocation() {
- var loc = location.href;
- if (parseUserName(loc)) {
- return parseUserName(loc);
- }
- return '';
+ return parseUserName(location.href) || '';
+
}
function parseUserName(place) {
@@ -50,7 +51,7 @@
}
function getUserNameBySelector() {
- // @TODO Array-for.
+ // @TODO or Factory Method
var aVideo = '#watch-uploader-info > a';
if ($(aVideo)) {
return parseUserName($(aVideo).href);
/*
* @title +Subscribe Youtube RSS
* @description Subscribe Youtube Uploads RSS.
* @include http://http://www.youtube.com/*
* @license MIT License http://www.opensource.org/licenses/MIT
* @require
* @see http://let.hatelabo.jp/noromanba/let/gYC-yZeZ6_P0WQ (ParmaLink)
*
* [RSS]
* 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. Default Order by Updated
* http://gdata.youtube.com/feeds/base/users/youtube/uploads?orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2
*
* [NOTE]
* This bookmarklet that may conflict with the browser extension.
* If you have problems while using the Developer Tool(It's stuck or death),
* please try to disable the extension.
* ex) GoogleChrome: '--disable-extensions'
*/
var d = document;
function $(q) { return d.querySelector(q); }
void(
(function() {
if (getUserNameByLocation()) {
return goSubscribe(getUserNameByLocation());
}
return goSubscribe(getUserNameBySelector());
})()
);
function getUserNameByLocation() {
return parseUserName(location.href) || '';
}
function parseUserName(place) {
// @TODO HTMLAnchorElement .href
if (place && place.match(/http:\/\/www\.youtube\.com\/user\/(\w+).*/)) {
return RegExp.$1;
}
return '';
}
function getUserNameBySelector() {
// @TODO or Factory Method
var aVideo = '#watch-uploader-info > a';
if ($(aVideo)) {
return parseUserName($(aVideo).href);
}
var chView = '#playnav-curvideo-channel-name > a';
if ($(chView)) {
return parseUserName($(chView).href);
}
var newChView = 'upper-section, ytg-box > a';
if ($(newChView)) {
return parseUserName($(newChView).href);
}
alert('Oops.. Can\'t find HTMLAnchorElement!');
return '';
}
function goSubscribe(userName) {
if (userName) {
var baseFeed = 'http://gdata.youtube.com/feeds/base/users/' + userName + '/uploads';
var apiQuery = '?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile';
var defaultFeed = baseFeed + apiQuery;
var streamAnchor = '#stream/feed/' + defaultFeed;
if (confirm('Sucscribe [ ' + userName + ' ] ?\n')) {
var readerPreview = 'http://google.com/reader/view/feed/';
location.href = readerPreview + encodeURIComponent(defaultFeed + streamAnchor);
}
}
}
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。