• GNU/Linux Admin

    @a_5mith unpublish the broken version from npm? 😄


  • @julian npm unpublish nodebb-plugin-youtube-lite@0.3.1 ???

  • GNU/Linux Admin

    Yessir ???


  • This is my two cents. This is a fix for users when paste yt videos with &something

    library.js:

    (function(module) {
            "use strict";
    
            var YoutubeLite = {},
                    embed = '<div class="js-lazyYT" data-youtube-id="$1" data-width="640" data-height="360"><iframe class="lazytube" src="//www.youtube.com/embed/$1"></iframe></div>';
    
                var regularUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtube\.com)\/(?:watch\?v=)(.+)">.+<\/a>/g;
            var     shortUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtu\.be)\/(.+)">.+<\/a>/g;
            var     embedUrl = /<a href="(?:https?:\/\/)?(?:www\.)youtube.com\/embed\/([\w\-_]+)">.+<\/a>/;
            var     longUrl = /<a href="(?:https?:\/\/)?(?:www\.)?(?:youtube\.com)\/(?:watch\?v=)(.+)&.+">.+<\/a>/g;
    
        YoutubeLite.parse = function(data, callback) {
            if (!data || !data.postData || !data.postData.content) {
                return callback(null, data);
            }
            if (data.postData.content.match(embedUrl)) {
                data.postData.content = data.postData.content.replace(embedUrl, embed);
            }
            if (data.postData.content.match(longUrl)) {
                data.postData.content = data.postData.content.replace(longUrl, embed);
            }
            if (data.postData.content.match(regularUrl)) {
                data.postData.content = data.postData.content.replace(regularUrl, embed);
            }
            if (data.postData.content.match(shortUrl)) {
                data.postData.content = data.postData.content.replace(shortUrl, embed);
            }
            callback(null, data);
    
        };
    
            module.exports = YoutubeLite;
    }(module));
    

  • I am trying to put some css in to make these resposive with no such luck, anyone have a css code that works? Thanks.


  • @RazorAxis said:

    I am trying to put some css in to make these resposive with no such luck, anyone have a css code that works? Thanks.

    Remove these two lines.

    https://github.com/a5mith/nodebb-plugin-youtube-lite/blob/master/static/style.less#L31-L32


  • Thank you 🙂

  • Plugin & Theme Dev

    So the following happened:

    We over at BitBangers were discussing about forking this plugin and adding a prefix to allow of just posting the link in the shoutbox, and not the enormous embed view. So I started doing that.

    When I was done, I remembered that in 0.6.x there are a couple parsing hook changes and that it won't matter because the shoutbox will use parse.raw, and this plugin listens to parse.post.

    I still pushed it to my repo so do with it what you want 🙂

    In short, if you prefix a youtube url with a !, it'll show something like this. Clicking on the icon will toggle the embed view.

    Choosing ! as prefix probably wasn't the best idea but you can easily change it in the regex.

    https://github.com/Schamper/nodebb-plugin-youtube-lite


  • Version 0.4.0 has been released of this. Probably didn't need such a large release, but for anyone not using NodeBBs markdown editor, probably won't work for you. So will try and keep both v0.3.x and v0.4.x similar, minus the changes.

    So @Julian did something and submitted a PR.

    Removed old use of parse hooks, relying purely on markdown parser update now.

    Yeah, 0.4.0 if you want that. 😆👍

    EDIT: The PR if anyone wants to see what's changed.


  • Video name does not appear. And console says:

    http://gdata.youtube.com/feeds/api/videos/1QCK_gFGi90?v=2&alt=json Failed to load resource: the server responded with a status of 410 (Gone)

    0_1476970952307_Screenshot_1.png

Suggested Topics

  • 1
  • 66
  • 6
  • 5
  • 12
| |