• So errm how do i get the videos to embed?

    When i paste a link to a youtube video it just puts the link, do i ahve to do something special to get the video to show?


  • @Scuzz the plugins in a bit of a state at the minute, the ref link has been removed so if you're on the latest version via github then it probably won't work. You should enter the link, but if there's an issue I'll take a look at it now.


  • Plugin now works fine. 👍


  • For users of 0.6.x of NodeBB, please use version 0.3.2. 0.3.1 could cause the fluid containers to stop working due to me adding a random h to the end of the lazyYT.js file.

    :headdesk:

  • GNU/Linux Admin

    @a_5mith unpublish the broken version from npm? 😄


  • @julian npm unpublish [email protected] ???

  • 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

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