You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added a simple polyfill for the fetch API that uses a GreaseMonkey API, which should get around CSP issues.
I've added a function for converting Blobs to data URLs, as the blob: URLs from URL.createObjectURL can be blocked by CSP.
// ==UserScript==// @name DeArrow for Invidious// @namespace http://tampermonkey.net/// @version 0.2.2// @description Adds support for DeArrow in Invidious// @author You// @match https://yewtu.be/*// @icon https://dearrow.ajay.app/logo.svg// @grant GM.xmlHttpRequest// @author Macic-Dev// @author Minion3665// @author Basil// @author Ajay// ==/UserScript==(asyncfunction(){'use strict';/** * A simple fetch polyfill that uses the GreaseMonkey API * * @param {string} url - the URL to fetch */functionfetch(url){returnnewPromise(resolve=>{GM.xmlHttpRequest({method: 'GET',
url,responseType: 'blob',onload: res=>{constheaders=res.responseHeaders.split('\r\n').reduce((prev,str)=>{const[key,val]=str.split(/:(.*)/s);if(key==='')returnprev;prev[key.toLowerCase()]=val;returnprev;},{});resolve({headers: {get: key=>headers[key.toLowerCase()]},status: res.status,blob: async()=>res.response,json: async()=>JSON.parse(awaitnewResponse(res.response).text())});}});});}/** * Converts a Blob to a data URL in order to get around CSP * * @param {Blob} blob - the URL to fetch */functionblobToDataURI(blob){returnnewPromise(resolve=>{constreader=newFileReader();reader.readAsDataURL(blob);reader.onloadend=()=>resolve(reader.result);});}/** * Fetch data for a video, and then update the elements passed to reflect that * * @param {string} videoId - the YouTube ID of the video (the bit that comes after v= in watch URLs) * @param {HTMLElement} titleElement - the element containing the video title which will be updated if DeArrow has a title * @param {HTMLElement|undefined} thumbnailElement - the element containing the video thumbnail which will be updated if DeArrow has a thumbnail */asyncfunctionfetchAndUpdate(videoId,titleElement,thumbnailElement=undefined){constoldTitle=titleElement.textContent;constoldThumbnail=thumbnailElement?.src;constcachedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}`);constcachedNewTitle=cachedThumbnailAPIResponse.headers.get('X-Title');if(cachedNewTitle)replaceTitle(titleElement,cachedNewTitle);if(thumbnailElement!==undefined&&cachedThumbnailAPIResponse.status===200){constcachedNewThumbnail=awaitcachedThumbnailAPIResponse.blob();thumbnailElement.src=awaitblobToDataURI(cachedNewThumbnail);}constbrandingAPIResponse=await(awaitfetch(`https://sponsor.ajay.app/api/branding?videoID=${videoId}`)).json();{lettopTitle=brandingAPIResponse.titles[0];letusedTitle=(topTitle&&(topTitle.votes>=0||topTitle.locked)) ? topTitle : null;replaceTitle(titleElement,usedTitle?.title??oldTitle);}{lettopThumbnail=brandingAPIResponse.thumbnails[0];letusedThumbnail=(topThumbnail&&(topThumbnail.votes>=0||topThumbnail.locked)) ? topThumbnail : null;letrandomTime=brandingAPIResponse.videoDuration ? brandingAPIResponse.videoDuration*brandingAPIResponse.randomTime : 0;if(usedThumbnail&&usedThumbnail.original){thumbnailElement.src=oldThumbnail;}else{constvotedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${usedThumbnail?.timestamp??randomTime}`);thumbnailElement.src=awaitblobToDataURI(awaitvotedThumbnailAPIResponse.blob());}}}// Replaces the title of elementsfunctionreplaceTitle(element,text){if(element.nodeName==='H1'){for(constchildofelement.childNodes){if(child.nodeName!=='#text')continue;child.textContent=text;break;}}else{element.textContent=text;}}// Videos on pageconstthumbnailDivs=document.querySelectorAll('div.thumbnail');thumbnailDivs.forEach((div)=>{constvideoUrl=newURL(div.parentNode.href);constvideoId=videoUrl.searchParams.get('v');consttitleP=[...div.parentNode.querySelectorAll('p')][1];constthumbnailImg=div.querySelector('img.thumbnail');voidfetchAndUpdate(videoId,titleP,thumbnailImg);});// Current videoconstcurrentUrl=newURL(document.URL);if(currentUrl.pathname=='/watch'){constcurrentId=currentUrl.searchParams.get('v');consttitleH=document.querySelector('h1');constthumbnailDiv=document.querySelector('.vjs-poster');awaitfetchAndUpdate(currentId,titleH,thumbnailDiv);if(thumbnailDiv.src)thumbnailDiv.style.backgroundImage=`url(${thumbnailDiv.src})`;document.title=`${titleH.textContent} - Invidious`;}})();
@aggarwalsushant This may fix your issue. Also, you have to change the URL in @match to the URL of whichever Invidious instance you're using.
Reacted by solisinvictum, Sushant Aggarwal, Skyler Grey, Chev and sma33in
Reacted by solisinvictum, Sushant Aggarwal and Skyler Grey
@ajayyy@gBasil worked great now. Thanks. 👏🏽
Obviously the counters in the Dearrow plugin won't rise as it's the ViolentMonkey doing the things now.
Will this script work for Piped instances too?
// ==UserScript==// @name DeArrow for Invidious// @namespace http://tampermonkey.net/// @version 0.2.3// @description Adds support for DeArrow in Invidious// @match https://yewtu.be/*// @match https://iv.ggtyler.dev/*// @icon https://dearrow.ajay.app/logo.svg// @grant GM.xmlHttpRequest// @author Macic-Dev// @author Minion3665// @author Basil// @author Ajay// ==/UserScript==(asyncfunction(){'use strict';/** * A simple fetch polyfill that uses the GreaseMonkey API * * @param {string} url - the URL to fetch */functionfetch(url){returnnewPromise(resolve=>{GM.xmlHttpRequest({method: 'GET',
url,responseType: 'blob',onload: res=>{constheaders=res.responseHeaders.split('\r\n').reduce((prev,str)=>{const[key,val]=str.split(/:(.*)/s);if(key==='')returnprev;prev[key.toLowerCase()]=val;returnprev;},{});resolve({headers: {get: key=>headers[key.toLowerCase()]},status: res.status,blob: async()=>res.response,json: async()=>JSON.parse(awaitnewResponse(res.response).text())});}});});}/** * Converts a Blob to a data URL in order to get around CSP * * @param {Blob} blob - the URL to fetch */functionblobToDataURI(blob){returnnewPromise(resolve=>{constreader=newFileReader();reader.readAsDataURL(blob);reader.onloadend=()=>resolve(reader.result);});}/** * Fetch data for a video, and then update the elements passed to reflect that * * @param {string} videoId - the YouTube ID of the video (the bit that comes after v= in watch URLs) * @param {HTMLElement} titleElement - the element containing the video title which will be updated if DeArrow has a title * @param {HTMLElement|undefined} thumbnailElement - the element containing the video thumbnail which will be updated if DeArrow has a thumbnail */asyncfunctionfetchAndUpdate(videoId,titleElement,thumbnailElement=undefined){constoldTitle=titleElement.textContent;constoldThumbnail=thumbnailElement?.src;constcachedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}`);constcachedNewTitle=cachedThumbnailAPIResponse.headers.get('X-Title');if(cachedNewTitle)replaceTitle(titleElement,cachedNewTitle);if(thumbnailElement!==undefined&&cachedThumbnailAPIResponse.status===200){constcachedNewThumbnail=awaitcachedThumbnailAPIResponse.blob();thumbnailElement.src=awaitblobToDataURI(cachedNewThumbnail);}constbrandingAPIResponse=await(awaitfetch(`https://sponsor.ajay.app/api/branding?videoID=${videoId}`)).json();{lettopTitle=brandingAPIResponse.titles[0];letusedTitle=(topTitle&&(topTitle.votes>=0||topTitle.locked)) ? topTitle : null;replaceTitle(titleElement,usedTitle?.title??oldTitle);}{lettopThumbnail=brandingAPIResponse.thumbnails[0];letusedThumbnail=(topThumbnail&&(topThumbnail.votes>=0||topThumbnail.locked)) ? topThumbnail : null;letrandomTime=brandingAPIResponse.videoDuration ? brandingAPIResponse.videoDuration*brandingAPIResponse.randomTime : 0;if(usedThumbnail&&usedThumbnail.original){thumbnailElement.src=oldThumbnail;}else{constvotedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${usedThumbnail?.timestamp??randomTime}`);thumbnailElement.src=awaitblobToDataURI(awaitvotedThumbnailAPIResponse.blob());}}}// Replaces the title of elementsfunctionreplaceTitle(element,text){if(element.nodeName==='H1'){for(constchildofelement.childNodes){if(child.nodeName!=='#text')continue;child.textContent=text;break;}}else{element.textContent=text;}}// Videos on pageconstthumbnailDivs=document.querySelectorAll('div.thumbnail');thumbnailDivs.forEach((div)=>{if(div.parentNode.nodeName==='DIV'){// First link. Selector could be better.constlink=div.querySelector('a');// Make sure we aren't fetching channel URLsif(link.href.startsWith('/channel/'))return;constvideoUrl=newURL(link.href);constvideoId=videoUrl.searchParams.get('v');consttitleP=div.parentNode.children[1].querySelector('p');constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}else{// Make sure we aren't fetching channel URLsif(div.parentNode.href.startsWith('/channel/'))return;constvideoUrl=newURL(div.querySelector('a').href);constvideoId=videoUrl.searchParams.get('v');consttitleP=[...div.parentNode.querySelectorAll('p')][1];constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}});// Current videoconstcurrentUrl=newURL(document.URL);if(currentUrl.pathname=='/watch'){constcurrentId=currentUrl.searchParams.get('v');consttitleH=document.querySelector('h1');constthumbnailDiv=document.querySelector('.vjs-poster');awaitfetchAndUpdate(currentId,titleH,thumbnailDiv);if(thumbnailDiv.src)thumbnailDiv.style.backgroundImage=`url(${thumbnailDiv.src})`;document.title=`${titleH.textContent} - Invidious`;}})();
Maybe author of this script should make repo for it, so we can easily find latest version and pull request our changes?
// ==UserScript==// @name DeArrow for Invidious// @namespace http://tampermonkey.net/// @version 0.2.3// @description Adds support for DeArrow in Invidious// @match https://yewtu.be/*// @match https://iv.ggtyler.dev/*// @icon https://dearrow.ajay.app/logo.svg// @grant GM.xmlHttpRequest// @author Macic-Dev// @author Minion3665// @author Basil// @author Ajay// ==/UserScript==(asyncfunction(){'use strict';/** * A simple fetch polyfill that uses the GreaseMonkey API * * @param {string} url - the URL to fetch */functionfetch(url){returnnewPromise(resolve=>{GM.xmlHttpRequest({method: 'GET',
url,responseType: 'blob',onload: res=>{constheaders=res.responseHeaders.split('\r\n').reduce((prev,str)=>{const[key,val]=str.split(/:(.*)/s);if(key==='')returnprev;prev[key.toLowerCase()]=val;returnprev;},{});resolve({headers: {get: key=>headers[key.toLowerCase()]},status: res.status,blob: async()=>res.response,json: async()=>JSON.parse(awaitnewResponse(res.response).text())});}});});}/** * Converts a Blob to a data URL in order to get around CSP * * @param {Blob} blob - the URL to fetch */functionblobToDataURI(blob){returnnewPromise(resolve=>{constreader=newFileReader();reader.readAsDataURL(blob);reader.onloadend=()=>resolve(reader.result);});}/** * Fetch data for a video, and then update the elements passed to reflect that * * @param {string} videoId - the YouTube ID of the video (the bit that comes after v= in watch URLs) * @param {HTMLElement} titleElement - the element containing the video title which will be updated if DeArrow has a title * @param {HTMLElement|undefined} thumbnailElement - the element containing the video thumbnail which will be updated if DeArrow has a thumbnail */asyncfunctionfetchAndUpdate(videoId,titleElement,thumbnailElement=undefined){constoldTitle=titleElement.textContent;constoldThumbnail=thumbnailElement?.src;constcachedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}`);constcachedNewTitle=cachedThumbnailAPIResponse.headers.get('X-Title');if(cachedNewTitle)replaceTitle(titleElement,cachedNewTitle);if(thumbnailElement!==undefined&&cachedThumbnailAPIResponse.status===200){constcachedNewThumbnail=awaitcachedThumbnailAPIResponse.blob();thumbnailElement.src=awaitblobToDataURI(cachedNewThumbnail);}constbrandingAPIResponse=await(awaitfetch(`https://sponsor.ajay.app/api/branding?videoID=${videoId}`)).json();{lettopTitle=brandingAPIResponse.titles[0];letusedTitle=(topTitle&&(topTitle.votes>=0||topTitle.locked)) ? topTitle : null;replaceTitle(titleElement,usedTitle?.title??oldTitle);}{lettopThumbnail=brandingAPIResponse.thumbnails[0];letusedThumbnail=(topThumbnail&&(topThumbnail.votes>=0||topThumbnail.locked)) ? topThumbnail : null;letrandomTime=brandingAPIResponse.videoDuration ? brandingAPIResponse.videoDuration*brandingAPIResponse.randomTime : 0;if(usedThumbnail&&usedThumbnail.original){thumbnailElement.src=oldThumbnail;}else{constvotedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${usedThumbnail?.timestamp??randomTime}`);thumbnailElement.src=awaitblobToDataURI(awaitvotedThumbnailAPIResponse.blob());}}}// Replaces the title of elementsfunctionreplaceTitle(element,text){if(element.nodeName==='H1'){for(constchildofelement.childNodes){if(child.nodeName!=='#text')continue;child.textContent=text;break;}}else{element.textContent=text;}}// Videos on pageconstthumbnailDivs=document.querySelectorAll('div.thumbnail');thumbnailDivs.forEach((div)=>{if(div.parentNode.nodeName==='DIV'){// First link. Selector could be better.constlink=div.querySelector('a');// Make sure we aren't fetching channel URLsif(link.href.startsWith('/channel/'))return;constvideoUrl=newURL(link.href);constvideoId=videoUrl.searchParams.get('v');consttitleP=div.parentNode.children[1].querySelector('p');constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}else{// Make sure we aren't fetching channel URLsif(div.parentNode.href.startsWith('/channel/'))return;constvideoUrl=newURL(div.querySelector('a').href);constvideoId=videoUrl.searchParams.get('v');consttitleP=[...div.parentNode.querySelectorAll('p')][1];constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}});// Current videoconstcurrentUrl=newURL(document.URL);if(currentUrl.pathname=='/watch'){constcurrentId=currentUrl.searchParams.get('v');consttitleH=document.querySelector('h1');constthumbnailDiv=document.querySelector('.vjs-poster');awaitfetchAndUpdate(currentId,titleH,thumbnailDiv);if(thumbnailDiv.src)thumbnailDiv.style.backgroundImage=`url(${thumbnailDiv.src})`;document.title=`${titleH.textContent} - Invidious`;}})();
Maybe author of this script should make repo for it, so we can easily find latest version and pull request our changes?
I'm not sure who the original author is, but maybe Ajay could? But it would be ideal if this was just integrated directly into DeArrow (I'm surprised it hasn't been added yet).
This update should fix any thumbnail-related issues:
// ==UserScript==// @name DeArrow for Invidious// @namespace http://tampermonkey.net/// @version 0.2.4// @description Adds support for DeArrow in Invidious// @match https://yewtu.be/*// @match https://iv.ggtyler.dev/*// @icon https://dearrow.ajay.app/logo.svg// @grant GM.xmlHttpRequest// @author Macic-Dev// @author Minion3665// @author Basil// @author Ajay// @author Euphoriyy// ==/UserScript==(asyncfunction(){'use strict';/** * A simple fetch polyfill that uses the GreaseMonkey API * * @param {string} url - the URL to fetch */functionfetch(url){returnnewPromise(resolve=>{GM.xmlHttpRequest({method: 'GET',
url,responseType: 'blob',onload: res=>{constheaders=res.responseHeaders.split('\r\n').reduce((prev,str)=>{const[key,val]=str.split(/:(.*)/s);if(key==='')returnprev;prev[key.toLowerCase()]=val;returnprev;},{});resolve({headers: {get: key=>headers[key.toLowerCase()]},status: res.status,blob: async()=>res.response,json: async()=>JSON.parse(awaitnewResponse(res.response).text())});}});});}/** * Converts a Blob to a data URL in order to get around CSP * * @param {Blob} blob - the URL to fetch */functionblobToDataURI(blob){returnnewPromise(resolve=>{constreader=newFileReader();reader.readAsDataURL(blob);reader.onloadend=()=>resolve(reader.result);});}/** * Fetch data for a video, and then update the elements passed to reflect that * * @param {string} videoId - the YouTube ID of the video (the bit that comes after v= in watch URLs) * @param {HTMLElement} titleElement - the element containing the video title which will be updated if DeArrow has a title * @param {HTMLElement|undefined} thumbnailElement - the element containing the video thumbnail which will be updated if DeArrow has a thumbnail */asyncfunctionfetchAndUpdate(videoId,titleElement,thumbnailElement=undefined){constoldTitle=titleElement.textContent;constoldThumbnail=thumbnailElement?.src;constcachedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}`);constcachedNewTitle=cachedThumbnailAPIResponse.headers.get('X-Title');if(cachedNewTitle)replaceTitle(titleElement,cachedNewTitle);if(thumbnailElement!==undefined&&cachedThumbnailAPIResponse.status===200&&cachedThumbnailAPIResponse.headers.get("X-Timestamp")!=="0.0"){constcachedNewThumbnail=awaitcachedThumbnailAPIResponse.blob();thumbnailElement.src=awaitblobToDataURI(cachedNewThumbnail);}constbrandingAPIResponse=await(awaitfetch(`https://sponsor.ajay.app/api/branding?videoID=${videoId}`)).json();{lettopTitle=brandingAPIResponse.titles[0];letusedTitle=(topTitle&&(topTitle.votes>=0||topTitle.locked)) ? topTitle : null;replaceTitle(titleElement,usedTitle?.title??oldTitle);}if(brandingAPIResponse.thumbnails.length>0){lettopThumbnail=brandingAPIResponse.thumbnails[0];letusedThumbnail=(topThumbnail&&(topThumbnail.votes>=0||topThumbnail.locked)) ? topThumbnail : null;letrandomTime=brandingAPIResponse.videoDuration ? brandingAPIResponse.videoDuration*brandingAPIResponse.randomTime : 0;if(usedThumbnail&&usedThumbnail.original){thumbnailElement.src=oldThumbnail;}else{constvotedThumbnailAPIResponse=awaitfetch(`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${usedThumbnail?.timestamp??randomTime}`);thumbnailElement.src=awaitblobToDataURI(awaitvotedThumbnailAPIResponse.blob());}}}// Replaces the title of elementsfunctionreplaceTitle(element,text){if(element.nodeName==='H1'){for(constchildofelement.childNodes){if(child.nodeName!=='#text')continue;child.textContent=text;break;}}else{element.textContent=text;}}// Videos on pageconstthumbnailDivs=document.querySelectorAll('div.thumbnail');thumbnailDivs.forEach((div)=>{if(div.parentNode.nodeName==='DIV'){// First link. Selector could be better.constlink=div.querySelector('a');// Make sure we aren't fetching channel URLsif(link.href.startsWith('/channel/'))return;constvideoUrl=newURL(link.href);constvideoId=videoUrl.searchParams.get('v');consttitleP=div.parentNode.children[1].querySelector('p');constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}else{// Make sure we aren't fetching channel URLsif(div.parentNode.href.startsWith('/channel/'))return;constvideoUrl=newURL(div.querySelector('a').href);constvideoId=videoUrl.searchParams.get('v');consttitleP=[...div.parentNode.querySelectorAll('p')][1];constthumbnailImg=div.querySelector('img.thumbnail');fetchAndUpdate(videoId,titleP,thumbnailImg);}});// Current videoconstcurrentUrl=newURL(document.URL);if(currentUrl.pathname=='/watch'){constcurrentId=currentUrl.searchParams.get('v');consttitleH=document.querySelector('h1');constthumbnailDiv=document.querySelector('.vjs-poster');awaitfetchAndUpdate(currentId,titleH,thumbnailDiv);if(thumbnailDiv.src)thumbnailDiv.style.backgroundImage=`url(${thumbnailDiv.src})`;document.title=`${titleH.textContent} - Invidious`;}})();
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing. Here is the script in case anyone finds a solution to this.
I implemented basic DeArrow support in my extension for Invidious: extraneous.
Slapped it together today; it has some additional features such as LocalStorage-based watched video markers and hiding videos based on duration/title. Contributions are welcome. Only tested on Firefox so far.
Reacted by Skyler Grey, Ajay Ramachandran, Cirnos and Moheshwar Amarnath Biswas
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing. Here is the script in case anyone finds a solution to this.
Would something like this work? Maybe add each video on the page to some list and check against that so as to avoid spamming the deArrow API but just running the main section of the code multiple times after a delay?
letretries=3;constintervalID=setInterval(_=>{console.log(retries)main();//The main loop of the function, ie. the "videos on page" sectionretries--;if(retries==0)clearInterval(intervalID);},2500);//some delay, here 2.5 seconds
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing. Here is the script in case anyone finds a solution to this.
Would something like this work? Maybe add each video on the page to some list and check against that so as to avoid spamming the deArrow API but just running the main section of the code multiple times after a delay?
letretries=3;constintervalID=setInterval(_=>{console.log(retries)main();//The main loop of the function, ie. the "videos on page" sectionretries--;if(retries==0)clearInterval(intervalID);},2500);//some delay, here 2.5 seconds
In fact, here's a working version (with an option for formatting titles as lowercase with no emotes added, for myself)
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing. Here is the script in case anyone finds a solution to this.
Would something like this work? Maybe add each video on the page to some list and check against that so as to avoid spamming the deArrow API but just running the main section of the code multiple times after a delay?
letretries=3;constintervalID=setInterval(_=>{console.log(retries)main();//The main loop of the function, ie. the "videos on page" sectionretries--;if(retries==0)clearInterval(intervalID);},2500);//some delay, here 2.5 seconds
The above might work, but you'd typically use a MutationObserver to intercept the playlist videos as they are being added to the DOM and do the required processing.
I'm currently working on implementing this in extraneous.
Edit: Correction - Not just a might. It does work, nice!
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing. Here is the script in case anyone finds a solution to this.
Would something like this work? Maybe add each video on the page to some list and check against that so as to avoid spamming the deArrow API but just running the main section of the code multiple times after a delay?
letretries=3;constintervalID=setInterval(_=>{console.log(retries)main();//The main loop of the function, ie. the "videos on page" sectionretries--;if(retries==0)clearInterval(intervalID);},2500);//some delay, here 2.5 seconds
The above might work, but you'd typically use a MutationObserver to intercept the playlist videos as they are being added to the DOM and do the required processing. I'm currently working on implementing this in extraneous.
Edit: Correction - Not just a might. It does work, nice!
Just found out about MutationObservers actually! Updated the script with one that works and is a little less spammy, although ideally we wouldn't re-check every video on the page afterwards. That requires a bit of refactoring, though.
Extraneous (repo, AMO) has been screened and is now available via the official Firefox Addon Store! It behaves as specified in the documentation and is reasonably robust. Contributions, feature requests or general feedback are very welcome.
For Chromium, manual installation instructions are provided in the repository, although the DeArrow module is currently not working (issue 6). Chromium won't be officially supported, but should anyone be interested in using the plugin themselves, I'm not opposed to merging fixes for Chromium.
Reacted by Krodzango
Reacted by Ajay Ramachandran, Rikj000 and divyansh
Reacted by jvschiavo, Cirnos, Rikj000 and Jake Klingler
Activity
codenyte commentedon Jun 20, 2023
Invidious would be nice as well, I use Piped myself, but it's always better to have multiple options
[-]Support Piped[/-][+]Support Piped/Invidious[/+]ajayyy commentedon Jun 28, 2023
Minion3665 commentedon Jul 6, 2023
gBasil commentedon Jul 6, 2023
solisinvictum commentedon Jul 10, 2023
gBasil commentedon Jul 11, 2023
conclusionary commentedon Jul 15, 2023
Oh just use a userscript manager extension/addon, I would recomend Violentmonkey since the project is 100% open-source.
aggarwalsushant commentedon Jul 17, 2023
ajayyy commentedon Jul 17, 2023
gBasil commentedon Jul 17, 2023
I've modified Ajay's script again.
fetchAPI that uses a GreaseMonkey API, which should get around CSP issues.blob:URLs fromURL.createObjectURLcan be blocked by CSP.@aggarwalsushant This may fix your issue. Also, you have to change the URL in @match to the URL of whichever Invidious instance you're using.
solisinvictum commentedon Jul 17, 2023
thanks! that works great.
aggarwalsushant commentedon Jul 17, 2023
@ajayyy @gBasil worked great now. Thanks. 👏🏽
Obviously the counters in the Dearrow plugin won't rise as it's the ViolentMonkey doing the things now.
Will this script work for Piped instances too?
aggarwalsushant commentedon Jul 17, 2023
Seems doesn't work with piped for now.
28 remaining items
shaedrich commentedon May 7, 2024
Well, for the frontend. However, as far as I know, one can't do any submissions yet. That would be quite helpful.
T3M1N4L commentedon Jul 23, 2024
Returns this

(yewtube)
filip2cz commentedon Jul 26, 2024
Maybe author of this script should make repo for it, so we can easily find latest version and pull request our changes?
gBasil commentedon Jul 26, 2024
I'm not sure who the original author is, but maybe Ajay could? But it would be ideal if this was just integrated directly into DeArrow (I'm surprised it hasn't been added yet).
shaedrich commentedon Jul 27, 2024
Are there any plans to implement that?
Euphoriyy commentedon Aug 16, 2024
This update should fix any thumbnail-related issues:
Kladki commentedon Aug 30, 2024
Thanks for the script! One small area that is not covered though: the playlist videos while watching a video:

If that could be covered, then I would have no issues with the script other than the lack of submission.
Kladki commentedon Sep 28, 2024
I have tried fixing this myself, and I have got it to work, with the catch of it only being when manually activated via context menu. This is because that playlist sidebar is loaded with javascript after the initial page load, meaning that the script is already finished executing before that sidebar loads in, preventing the thumbnails and titles from changing.
Here is the script in case anyone finds a solution to this.
sysrqmagician commentedon Dec 30, 2024
I implemented basic DeArrow support in my extension for Invidious: extraneous.
Slapped it together today; it has some additional features such as LocalStorage-based watched video markers and hiding videos based on duration/title. Contributions are welcome. Only tested on Firefox so far.
beesarefriends commentedon Dec 31, 2024
Would something like this work? Maybe add each video on the page to some list and check against that so as to avoid spamming the deArrow API but just running the main section of the code multiple times after a delay?
beesarefriends commentedon Dec 31, 2024
In fact, here's a working version (with an option for formatting titles as lowercase with no emotes added, for myself)
sysrqmagician commentedon Dec 31, 2024
The above might work, but you'd typically use a MutationObserver to intercept the playlist videos as they are being added to the DOM and do the required processing.
I'm currently working on implementing this in extraneous.
Edit: Correction - Not just a might. It does work, nice!
beesarefriends commentedon Dec 31, 2024
Just found out about MutationObservers actually! Updated the script with one that works and is a little less spammy, although ideally we wouldn't re-check every video on the page afterwards. That requires a bit of refactoring, though.
Kladki commentedon Dec 31, 2024
Nice that you found a solution. I have updated the script again now to use MutationObservers, but instead only update the playlist items instead of every video: https://gist.github.com/Kladki/101f0da6511906460252e26ea78d8ec3
sysrqmagician commentedon Jan 3, 2025
Extraneous (repo, AMO) has been screened and is now available via the official Firefox Addon Store! It behaves as specified in the documentation and is reasonably robust. Contributions, feature requests or general feedback are very welcome.
For Chromium, manual installation instructions are provided in the repository, although the DeArrow module is currently not working (issue 6). Chromium won't be officially supported, but should anyone be interested in using the plugin themselves, I'm not opposed to merging fixes for Chromium.