最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Is it possible to convert bunch of arrayBuffer`s to video? - Stack Overflow

programmeradmin4浏览0评论

I am seeking for any possible solution to bypass MEGA.NZ quotas for downloading(I know about changing IP method, and also I have tried to download videostream but MEGA has stream quotas as well). There is some way to download images easily. You could simply copy blob link from image and put in anchor tag. Now I am looking for something to help to make the same trick with videos. As I know MEGA uses service workers to decrypt and download files. I opened a video and went to IndexedDB. There I found a bunch of objects with ArrayBuffers of different size.

I have tried this code to get all of them and create file out of that but unsuccesful.

const request = indexedDB.open('lru_Q2y84VVMM3Ma0EiNGsWzywuRbkgzwc_DMeIp83SgjXU.13', 10);//two bases with data
const request2 = indexedDB.open('lru_qF3H__YLjtuV5S_3zD3Tzg7ks0R3jUNll4adC9XGAxM.13', 10);
const arrFile = []
request.onsuccess=function(){
    const db =request.result;
    const transaction = db.transaction('data', 'readwrite');
    const store = transaction.objectStore('data');
    const query = store.getAll();
    
    query.onsuccess = function () {
        console.log(query.result)
        query.result.forEach(chunk => {
          arrFile.push(chunk.data);
        })

    }
}
request2.onsuccess=function(){
  const db =request2.result;
  const transaction = db.transaction('data', 'readwrite');
  const store = transaction.objectStore('data');
  const query = store.getAll();
  
  query.onsuccess = function () {
    query.result.forEach(chunk => {
        arrFile.push(chunk.data);
      })
        const b = new Blob(aFile);
        const video = new File([b], 'test.mp4', {type: 'application/octet-stream'});
        const url = URL.createObjectURL(video);
        const a = document.createElement('a');
        a.href = url;
        a.download = video.name;
        a.textContent = 'download';
        const link = document.querySelector('body').appendChild(a);
        link.click();
    }
}

I got broken file. It doesnt match the filesize at all. I am curious if there any way to get the video and if not then why is that. I mean technically it is client side process so I have everything it needs to be done.

发布评论

评论列表(0)

  1. 暂无评论