Open ryukora opened 1 year ago
Hi there, sorry for the slow response.
This is definitely something I can do and I’ll put it in my list of things to do.
Hi there, sorry for the slow response.
This is definitely something I can do and I’ll put it in my list of things to do.
Okay, good luck with the project! I hope you can do it as well as you can.
Hi there, sorry for the slow response.
This is definitely something I can do and I’ll put it in my list of things to do.
Maybe the REGEX of Instagram reels and posts should work like this.
this.defaultSettings.instagram_reels = true;
this.defaultSettings.instagram_posts = true;
this.defaultSettings.DDInstagram_reels = false;
this.defaultSettings.DDInstagram_posts = false
const REGEX = {
"instagram_reels": /((?:https|http)\:\/\/(?:www\.)?instagram\.com\/(?:reel|reels)\/[a-zA-Z0-9-_]+\/?(?:\?\S+)?)\S*/g,
"instagram_posts": /((?:https|http)\:\/\/(?:www\.)?instagram\.com\/p\/[a-zA-Z0-9-_]+\/?(?:\?\S+)?)\S*/g,
// instagram_reels
// example of a instagram reels link
// https://www.instagram.com/reels/xxxxxxx/
if (this.settings.instagram_reels) {
if (msgcontent.includes("https://instagram.com/reel/")) {
// if it includes the instagram reels url then it'll flow down here and appropriately remove the trackers and update the url.
// note: for those of you who /care/ so much about speed you will get a very slight performance increase if you use DDInstagram.
msgcontent = this.sanitizeUrls(msgcontent, REGEX.instagram_reels);
if (this.settings.DDInstagram_reels) {
msgcontent = msgcontent.replace("https://instagram.com/reel/", "https://ddinstagram.com/reel/");
}
if (this.settings.showToasts && isFromSomeoneEsle == false) {
Toasts.success("Succesfully removed tracker from instagram reels link!");
}
}
}
// instagram_posts
// example of a instagram posts link
// https://www.instagram.com/p/xxxxxxxx/
if (this.settings.instagram_posts) {
if (msgcontent.includes("https://instagram.com/p/")) {
// if it includes the instagram posts url then it'll flow down here and appropriately remove the trackers and update the url.
// note: for those of you who /care/ so much about speed you will get a very slight performance increase if you use DDInstagram.
msgcontent = this.sanitizeUrls(msgcontent, REGEX.instagram_posts);
if (this.settings.DDInstagram_posts) {
msgcontent = msgcontent.replace("https://instagram.com/p/", "https://ddinstagram.com/p/");
}
if (this.settings.showToasts && isFromSomeoneEsle == false) {
Toasts.success("Succesfully removed tracker from instagram posts link!");
}
}
}
new Settings.Switch("Instagram Reels", "Remove instagram reels tracking URL", this.settings.instagram_reels, (i) => { this.settings.instagram_reels = i; }),
new Settings.Switch("Instagram Posts", "Remove instagram posts tracking URL", this.settings.instagram_posts, (i) => { this.settings.instagram_posts = i; })
new Settings.Switch("DDInstagram Reels", "Automatically convert instagram reels links to DDInstagram Reels links", this.settings.instagram_reels, (i) => { this.settings.instagram_reels = i; }),
new Settings.Switch("DDInstagram Posts", "Automatically convert instagram posts links to DDInstagram Posts links", this.settings.instagram_posts, (i) => { this.settings.instagram_posts = i; })
You can consider fixing what I just made, or you can make it yourself. Thanks!
Can you add
ddinstagram.com
(replacing Instagram alternative links for conversion and embedding with text and video) to removeTrackingURL? I'd like to if you can do it.These are examples of IG reels and posts:
www.instagram.com/reel/[videolink]/?igshid=[trackinglink]A==]
www.instagram.com/p/[postsimagelink]/?utm_source=ig_web_copy_link&igshid=[trackinglink]==
You can remove those tracking links if you don't need them.
Thanks! 🙏