-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you add a feature to forward images and videos to Telegram groups? #29
Comments
I don't use Telegram, but isn't that a phone messaging app and if you use this script with a script-compatible browser on your phone could you not forward via Twitter's built in share feature where it brings up your phone's modal? |
It's not possible to share some data directly to a desktop program from a web page. The Telegram Desktop is not a UWP application, as well as, it does not support Web Share API. let imageData = new File(new Uint8Array([0, 1, 2, 3]), "image-name.png", {type: "image/png"});
navigator.share({files: [imageData]}); ...although, maybe it will work on a mobile. Are you talked about the desktop version? However, technically, it's possible to exchange the data between two sites within one browser by using a blob:url as a URL's hash/parameter of an opened link, since browser extensions can bypass the CORS limitation and fetch this data from the passed blob:url. It will look the follow way: Instead of downloading of a blob on a Twitter page:
you can open a new tab with Web version of Telegram, with an extra data attached to the opened link after # :
const a = document.createElement("a");
a.href = "https://web.telegram.org/#" + blob;
a.rel = "noreferrer noopener nofollow";
a.target = "_blank";
a.click(); (It will open a link like this: Then, the other userscript can take the blob url from the browser's location: !async function demo() {
const blobUrl = document.location.hash.slice(1); // "blob:https://twitter.com/75bf2116-3171-41e9-bbb9-ef56835ca800"
const resp = await GM_fetch(blobUrl); // https://github.com/AlttiRi/gm_fetch#simple-wrapper
const bytes = await resp.arrayBuffer();
// Then do something with it:
console.log(new Uint8Array(bytes));
}(); But it's the work for an other userscript, not for this one. I don't think, that it's a work for few minutes. Why not just to download the media while you browser Twitter, then manually upload all of them to Telegram by one time? |
Mobile Firefox does not support file sharing, only mobile Chrome. You can check it here: https://alttiri.github.io/web-share-demo/ BTW, the uploaded to Telegram image by sharing from Chrome is reduced to |
I think this should be used to complete it |
No description provided.
The text was updated successfully, but these errors were encountered: