Ver código fonte

:recycle: accouting for youtube.com/watch? links

undefined
J 5 anos atrás
pai
commit
a53c63743e
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6
    2
      vue-theme/src/components/content-block/block.vue

+ 6
- 2
vue-theme/src/components/content-block/block.vue Ver arquivo

@@ -30,8 +30,12 @@ export default {
30 30
     },
31 31
     methods: {
32 32
         fixYoutubeUrl(url) {
33
-            const videoUid = url.split('https://youtu.be/').filter(pieces => pieces.length > 0)[0]
34
-
33
+            let videoUid = url.split('https://youtu.be/').filter(pieces => pieces.length > 0)[0]
34
+            
35
+            if(!videoUid) {
36
+                videoUid = url.split('https://www.youtube.com/watch?v=').filter(pieces => pieces.length > 0)[0]
37
+            }
38
+            
35 39
             return `https://www.youtube.com/embed/${videoUid}`
36 40
         }
37 41
     },

Carregando…
Cancelar
Salvar