# All files / src/lib/markdown-it/plugins/markdown-it-block-embed/services VineService.js

37.5% Statements 3/8
0% Branches 0/4
33.33% Functions 1/3
37.5% Lines 3/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    21x

    21x

    21x
     // Copyright (c) Rotorz Limited and portions by original markdown-it-video authors
    // Licensed under the MIT license. See LICENSE file in the project root.

    "use strict";

    const VideoServiceBase = require("./VideoServiceBase");

    class VineService extends VideoServiceBase {

      getDefaultOptions() {
        return { width: 600, height: 600, embed: "simple" };
      }

      extractVideoID(reference) {
        let match = reference.match(/^http(?:s?):\/\/(?:www\.)?vine\.co\/v\/([a-zA-Z0-9]{1,13}).*/);
        return match && match[1].length === 11 ? match[1] : reference;
      }

      getVideoUrl(videoID) {
        let escapedVideoID = this.env.md.utils.escapeHtml(videoID);
        let escapedEmbed = this.env.md.utils.escapeHtml(this.options.embed);
        return `//vine.co/v/${escapedVideoID}/embed/${escapedEmbed}`;
      }

    }

    module.exports = VineService;