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
tags: image hosting, regex, url, google drive, dropbox, advanced
return: string
Returns a string url that can be used directly as source of an image.
constgoobox=(url)=>{letdropbox_regex=/(http(s)*:\/\/)*(www\.)*(dropbox.com)/;letdrive_regex=/(http(s)*:\/\/)*(www\.)*(drive.google.com\/file\/d\/)/;if(url.match(dropbox_regex)){returnurl.replace(/(http(s)*:\/\/)*(www\.)*/,"https://dl.");}if(url.match(drive_regex)){return`https://drive.google.com/uc?id=${url.replace(drive_regex,"").match(/[\w]*\//)[0].replace(/\//,"")}`;}returnconsole.error('Wrong URL, not a vlid drobox or google drive url');}