otiai10 / chant

Chat Application written in Go, using Firebase, working on GAE/Go, easy to deploy
25 stars 2 forks source link

ニコ動の展開 #34

Closed otiai10 closed 9 years ago

otiai10 commented 10 years ago

http://urbanqee.com/webutil/movies/youtube/youtube-html-embed.html

yaakaito commented 10 years ago
<script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/sm797290?w=320h=240"></script>
otiai10 commented 10 years ago
<script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/sm797290?w=320h=240"></script>
otiai10 commented 9 years ago
otiai10 commented 9 years ago
<script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/sm24185817?w=490&h=307"></script><noscript><a href="http://www.nicovideo.jp/watch/sm24185817">Niconico 佐倉綾音に鎖骨を触られて火照っちゃう内田真礼【比較動画】</a></noscript>
otiai10 commented 9 years ago

smidだけ取れればあとはscriptつくればいいだけ

otiai10 commented 9 years ago

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

otiai10 commented 9 years ago

scriptでロードしたjsがdocument.writeしてるので、このjsがdocument.writeしようとしてる内容をこちらでやってあがればよい。

getHTML: function () {
        var id = this.id,
            video = this.video,
            attrs = this._merge(this.defaultAttributes, this.attributes),
            params = this._merge(this.defaultParameters, this.parameters),
            vars = this.variables;

        var flashvars = [];
        for (var key in vars) {
            flashvars.push(key + '=' + encodeURIComponent(vars[key]));
        }
        params.flashvars = flashvars.join("&");

        var html;
        switch (Nicovideo.Global.embedMode) {
        case "embed":
            html =
                '<embed type="application/x-shockwave-flash"'
                + ' id="' + id + '"'
                + ' name="' + id + '"'
                + ' src="' + Nicovideo.playerUrl + '"'
                + ' width="' + this.width  + '"'
                + ' height="' + this.height + '"'
                ;
            for (var key in params) {
                html += ' ' + key + '="' + params[key] + '"';
            }
            for (var key in attrs) {
                html += ' ' + key + '="' + attrs[key] + '"';
            }
            html += ' />';
            break;
        case "object":
            html =
                '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                + ' id="' + id + '"'
                + ' name="' + id + '"'
                + ' width="' + this.width + '"'
                + ' height="' + this.height + '"'
                ;
            for (var key in attrs) {
                html += ' ' + key + '="' + attrs[key] + '"';
            }
            html += '>';
            html += '<param name="movie" value="' + Nicovideo.playerUrl + '" />';
            for (var key in params) {
                html += '<param name="' + key + '" value="' + params[key] + '" />';
            }
            html += '</object>';
            break;
        default:
            html =
                '<div style="'
                        + 'width:' + (this.width === "100%" ? this.width : this.width + "px")
                        + '; height:' + (this.height === "100%" ? this.height : this.height + "px")
                        + '; display:inline-block; background:#000; color:#FFF; margin:0; padding:0; overflow:hidden;">'
                + '<a href="' + video.getPlayURL() + '" target="_blank" title="' + this._escape(video.title) + '"'
                        + ' style="position:relative; display:inline-block; width:100%; height:100%;">'
                    + '<img src="' + video.thumbnail + '" alt="" style="width:100%; height:100%; border:none;" />';
            if (!video.isDeleted && (this.width === "100%" || this.width >= 240) && (this.height === "100%" || this.height >= 120)) {
                html += '<span style="display:inline-block; position:absolute; left:0; top:0; width:100%; height:100%;'
                            + ' background-image: url(http://res.nimg.jp/img/thumb/nico/play.png); background-repeat: no-repeat; background-position: center center;"></span>';
            }
            html += '</a>'
                + '</div>';
            break;
        }

        return html;
    },
    write: function (id) {
        if (id === undefined) {
            document.write(this.getHTML());
otiai10 commented 9 years ago

わりと生臭いことしてんのな