Alibaba download videos product

Download videos from alibaba - Descarga el video de un producto

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Alibaba download videos product
// @namespace    https://github.com/DeveloperMDCM
// @version      0.1
// @description  Download videos from alibaba - Descarga el video de un producto
// @author       MDCM
// @match        *://*.alibaba.com/*
// @icon         https://play-lh.googleusercontent.com/D09AsmYSxDpMWRSXbu54j2R_8sR-1OgbV2DXSI9_HIuY2IMZ8b8JgscWol6mikknaks
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    //https://github.com/DeveloperMDCM
    // MDCM
let video = document.querySelector('#main-video > div > div > div > video');
const linkDiv = document.querySelector("#container > div.layout-content > div > div.screen-body > div.screen-layout > div.layout-left > div.main-layout > div.thumb-list > div > div > div.detail-next-slick-list");
const link = document.createElement('DIV');

linkDiv.appendChild(link);
link.innerHTML = `<style>
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.button-container{
  background-color: red;
}
.button-container:hover{
  background-color: black;
}

a:hover{
  background-color: black;
}
</style>
<div style="margin: 6px 0;" class="container">
<button style=" width: 100%;border-radius: 20px; " class="button-container">
  <a style="color: #fff;"  class="link-descarga" href="#">Download Video</a>
</button>
</div>
`;

const download = async (url, filename) => {
  const data = await fetch(url)
  const blob = await data.blob()
  const objectUrl = URL.createObjectURL(blob)
  const link = document.createElement('a')
  link.setAttribute('href', objectUrl)
  link.setAttribute('download', filename)
  link.textContent = 'moises';
  link.click();
  const linkdescarga = document.querySelector('.link-descarga');
  linkdescarga.textContent = 'Espere un momento';
  setTimeout(()=>{
    linkdescarga.textContent = 'Download Video'
  },3000);
}


link.addEventListener('click', ()=>{
  video = document.querySelector('#main-video > div > div > div > video');
  console.log(video.src)
  download(`${video.src}`,'video-MDCM');
})


if(video) {
  setInterval(()=>{
    video = document.querySelector('#main-video > div > div > div > video').src;
  },1000);
};

})();