+Youtube

    @@ -21,22 +21,14 @@ * 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. + * This bookmarklet that may conflict with the Browser Extension or UserScript. * If you have problems while using the Developer Tool(It's stuck or death) or not, - * please try to disable the extension. - * ex) Google Chrome: use '--disable-extensions' option. + * please try to disable the extension and scripts. + * ex.) Google Chrome: use '--disable-extensions' option. */ -var d = document; -function $(q) { return d.querySelector(q); } - -void( - (function() { - if (getUserNameByLocation()) { - return goSubscribe(getUserNameByLocation()); - } - return goSubscribe(getUserNameBySelector()); - })() -); +(function() { + return goSubscribe(getUserNameByLocation() || getUserNameBySelector()); +})(); function getUserNameByLocation() { return parseUserName(location.href) || ''; @@ -52,6 +44,9 @@ } function getUserNameBySelector() { + var d = document; + var $ = function(q) { return d.querySelector(q); }; + // @TODO Refactor to Factory Method? var aVideo = '#watch-uploader-info > a'; var chView = '#playnav-curvideo-channel-name > a'; @@ -59,7 +54,7 @@ var anchor = $(aVideo) || $(chView) || $(newChView); if (!anchor) { - alert('Oops.. Can\'t find HTMLAnchorElement!'); + alert('Oops.. Can\'t find UserName!'); return ''; } return parseUserName(anchor.href);
  • /*
     * @title +Subscribe Youtube RSS
     * @description Subscribe Youtube Uploads RSS.
     * @include http://www.youtube.com/*
     * @include https://www.youtube.com/*
     * @license MIT License http://www.opensource.org/licenses/MIT
     * @require
     * @see http://let.hatelabo.jp/noromanba/let/gYC-yZeZ6_P0WQ (PermaLink)
     *
     * [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 or UserScript.
     * If you have problems while using the Developer Tool(It's stuck or death) or not,
     * please try to disable the extension and scripts.
     *  ex.) Google Chrome: use '--disable-extensions' option.
     */
    (function() {
        return goSubscribe(getUserNameByLocation() || getUserNameBySelector());
    })();
    
    function getUserNameByLocation() {
        return parseUserName(location.href) || '';
        
    }
    
    function parseUserName(anchor) {
        // @TODO HTMLAnchorElement .href
        if (anchor && anchor.match(/https?:\/\/www\.youtube\.com\/user\/(\w+).*/)) {
                return RegExp.$1;
        }
        return '';
    }
    
    function getUserNameBySelector() {
        var d = document;
        var $ = function(q) { return d.querySelector(q); };
    
        // @TODO Refactor to Factory Method?
        var aVideo = '#watch-uploader-info > a';
        var chView = '#playnav-curvideo-channel-name > a';
        var newChView = 'upper-section, ytg-box > a';
        
        var anchor = $(aVideo) || $(chView) || $(newChView);
        if (!anchor) {
            alert('Oops.. Can\'t find UserName!');
            return '';
        }
        return parseUserName(anchor.href);
    }
    
    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('Subscribe [ ' + 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 です。

History

  1. 2012/12/14 09:22:27 - 2012-12-14
  2. 2012/12/05 04:15:04 - 2012-12-05
  3. 2012/12/03 04:49:00 - 2012-12-03
  4. 2012/01/27 05:35:20 - 2012-01-27
  5. 2012/01/21 10:37:37 - 2012-01-21
  6. 2012/01/21 10:34:49 - 2012-01-21
  7. 2012/01/21 10:22:51 - 2012-01-21
  8. 2012/01/20 05:03:07 - 2012-01-20
  9. 2012/01/18 01:54:27 - 2012-01-18
  10. 2012/01/18 01:23:43 - 2012-01-18
  11. 2012/01/17 02:26:57 - 2012-01-17
  12. 2012/01/17 02:20:56 - 2012-01-17
  13. 2012/01/17 02:14:12 - 2012-01-17
  14. 2012/01/17 02:06:18 - 2012-01-17
  15. 2012/01/16 18:42:43 - 2012-01-16
  16. 2012/01/16 18:42:15 - 2012-01-16
  17. 2012/01/14 17:13:15 - 2012-01-14
  18. 2012/01/14 04:30:13 - 2012-01-14
  19. 2012/01/14 04:19:24 - 2012-01-14
  20. 2012/01/14 03:43:11 - 2012-01-14
  21. 2012/01/12 17:11:32 - 2012-01-12
  22. 2012/01/12 15:51:13 - 2012-01-12
  23. 2012/01/12 15:42:54 - 2012-01-12
  24. 2012/01/12 15:32:14 - 2012-01-12
  25. 2012/01/12 15:31:21 - 2012-01-12
  26. 2012/01/12 15:29:30 - 2012-01-12
  27. 2012/01/12 10:55:32 - 2012-01-12
  28. 2012/01/12 10:47:14 - 2012-01-12
  29. 2012/01/12 10:43:39 - 2012-01-12
  30. 2012/01/12 10:41:54 - 2012-01-12
  31. 2012/01/12 10:21:58 - 2012-01-12
  32. 2012/01/12 10:21:06 - 2012-01-12
  33. 2012/01/12 09:54:09 - 2012-01-12
  34. 2012/01/12 09:49:01 - 2012-01-12
  35. 2012/01/12 06:20:43 - 2012-01-12
  36. 2012/01/12 06:17:58 - 2012-01-12
  37. 2012/01/12 06:14:12 - 2012-01-12
  38. 2012/01/12 05:01:20 - 2012-01-12
  39. 2012/01/12 04:43:13 - 2012-01-12
  40. 2012/01/12 02:54:28 - 2012-01-12
  41. 2012/01/12 02:45:34 - 2012-01-12
  42. 2012/01/12 02:27:46 - 2012-01-12
  43. 2012/01/12 02:19:35 - 2012-01-12
  44. 2012/01/12 00:39:53 - 2012-01-12
  45. 2012/01/09 02:41:01 - 2012-01-09
  46. 2012/01/09 02:35:45 - 2012-01-09
  47. 2012/01/09 02:34:31 - 2012-01-09
  48. 2012/01/09 02:33:48 - 2012-01-09
  49. 2012/01/09 02:07:19 - 2012-01-09
  50. 2012/01/09 01:40:00 - 2012-01-09
  51. 2012/01/09 01:36:24 - 2012-01-09
  52. 2012/01/09 01:35:38 - 2012-01-09
  53. 2012/01/09 01:27:25 - 2012-01-09
  54. 2012/01/09 00:11:24 - 2012-01-09
  55. 2012/01/09 00:04:23 - 2012-01-09
  56. 2012/01/09 00:02:18 - 2012-01-09
  57. 2012/01/08 05:20:35 - 2012-01-08
  58. 2012/01/08 05:13:01 - 2012-01-08
  59. 2012/01/08 05:05:52 - 2012-01-08
  60. 2012/01/08 05:04:51 - 2012-01-08
  61. 2012/01/08 05:02:28 - 2012-01-08
  62. 2012/01/08 04:53:02 - 2012-01-08
  63. 2012/01/08 04:40:59 - 2012-01-08
  64. 2012/01/08 04:40:28 - 2012-01-08
  65. 2012/01/08 04:36:49 - 2012-01-08
  66. 2012/01/08 04:26:33 - 2012-01-08
  67. 2012/01/08 04:21:22 - 2012-01-08
  68. 2012/01/08 04:20:33 - 2012-01-08