Bitcoin Forum

Other => Meta => Topic started by: TryNinja on May 14, 2023, 07:38:14 AM



Title: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 07:38:14 AM
Imgur to TalkImg - automatically fix your broken images

Quote



Imgur images don't work anymore, so you probably have lots of posts with broken images that look like this:

https://www.talkimg.com/images/2023/05/12/issue41c65ee2f597cfb4.png

For context: Imgur images suddenly became invalid? (https://bitcointalk.org/index.php?topic=5452415.0)



So I created a script that:

1. Goes through all your posts looking for imgur.com direct links (.png|.jpg|.jpeg);
2. Reuploads the image to talkimg.com (or imgbb);
3. Edits the post with the new link.

How to use it:

1. Choose the image provider you want to use (change provider to imgbb or talkimg - IMPORTANT: all lower case).
2. If you choose imgbb, you need an account and your own API key. Generate your API key here (https://api.imgbb.com) and put it on providers -> imgbb -> apiKey (example (https://bitcointalk.org/index.php?topic=5452662.msg62246935#msg62246935)).
3. Go to bitcointalk.org (any page).
4. Open the browser developer tools on the Console tab (Ctrl+Shift+I or F12).
5. Paste the script and press Enter.
6. Leave the page open while the script runs and, if you can, do not use the forum (not even in other tabs) to avoid rate limiting errors.

If a error shows up, please report it here and/or run the script again (the process will start over, but already updated posts will be ignored since they won't have any more imgur.com links).

Script:

- If you're using TalkImg, you are free to swap the API key to your own if you have an account there. Otherwise, there is already one provided by @joker_josue for this script.
- You can change the startPage variable if you want to start the script from a specific page (i.e the script errors at page 300 and you want to restart back from there).

GET THE SCRIPT CODE HERE: https://gist.github.com/ninjastic/36c14fb2eb1c4b750f40f332d408688f



"Single Topic" version

Get the code here: https://gist.github.com/ninjastic/59bde80306c32153a5775b9a570b16b7

Run it on any topic and all images posted by you will be updated.

IMPORTANT: only images that are shown on the screen! This means that if you are on page 1, the script won't update the images on page 2. You can use the ;all page on the forum to make all posts show up all at once (probably won't work properly if the topic is huge?).



Other notes:

- This will upload and edit all imgur.com links found on your post history (even those inside quotes you made of other people).
- Posts on locked topics can't be edited, so the recently uploaded images for them will be deleted (to save space on the talkimg server).
- TalkImg max size limit is 2 MB, so some images may fail.



If you have broken bbcode resulted from an old version of the script, run this fix: https://gist.github.com/ninjastic/d560848568339e5a2d7a25ddffb578d5


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: cygan on May 14, 2023, 08:14:24 AM
i have now started the script and run it completely :)
but when i visit this thread (https://bitcointalk.org/index.php?topic=5275792.0) of mine the images still don't show up and the imgur error message is displayed...
the script should replace these imgur links with the new TalkImg links, or did i misunderstand something here ???

https://www.talkimg.com/images/2023/05/14/Screenshot-2023-04-30-202732bd73be559833b430.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Charles-Tim on May 14, 2023, 08:27:43 AM
I tried it too, first and second time on Chrome, later on Microsoft Edge. I saw finished too and I checked my topic pages history, the images are still not showing.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: decodx on May 14, 2023, 08:38:13 AM
Hey TryNinja, first of all, thanks for putting in the effort to create this script. However, I don't think I'll be using it. No offense, but I'm not very experienced with coding or using developer tools in the browser, and I'm not comfortable with the idea of a script altering my posts. It's not that I don't trust you, but I don't trust myself to not mess up something.  ;)

Can we make the process less automatic for members who prefer to manually edit their old posts? I had an idea that you or LoyceV might be able to assist with. For instance, adding a search function for posts with images or Imgur links to ninjastic.space would make it easier for members to manually locate and edit their old posts without relying on an automated script. This could be an additional parameter in the search settings that only displays posts with images. Do you think this would be possible?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 14, 2023, 08:52:45 AM
Thanks for this work around.  How do I set a specific folder for these legacy images?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 14, 2023, 09:04:24 AM
Can we make the process less automatic for members who prefer to manually edit their old posts? I had an idea that you or LoyceV might be able to assist with. For instance, adding a search function for posts with images or Imgur links to ninjastic.space would make it easier for members to manually locate and edit their old posts without relying on an automated script.
To add to this feature request: I've downloaded 796k images from imgur so far (and I'm almost done with all images from my archived posts). I could create one zip-file per userID with all their images. All you'd have to do is find the name given by imgur. I can probably make a list of posts too, but I think TryNinja can do that much faster (and on demand).


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 09:36:37 AM
Did you make talkimg.com server busy?

https://i.ibb.co/56tL9NH/talk.png

I am assuming a lot of data are now uploading by the script to their server and it's like a ddos attack for them LOL


Script:

https://i.ibb.co/TRKy65g/ffx.png

I am on Firefox using the TOR connection. But interestingly I can not copy and paste the code even anything to my console. What is the mystery?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Charles-Tim on May 14, 2023, 09:44:51 AM
I am assuming a lot of data are now uploading by the script to their server and it's like a ddos attack for them LOL
I have just uploaded an image twice on the site and it is working fine. Upload another image because maybe the image you wanted to upload is not of supported format.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 14, 2023, 11:48:21 AM
Thanks for this work around.  How do I set a specific folder for these legacy images?

I decided to go ahead and get things started.  I swapped out the API for the one I have on my account.  After 185 pages without any activity, this happened:

https://www.talkimg.com/images/2023/05/14/screenshot.3724c7797e1d42f02230.jpeg

...and the script stopped.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 14, 2023, 12:48:12 PM
Did you make talkimg.com server busy?

https://i.ibb.co/56tL9NH/talk.png

I am assuming a lot of data are now uploading by the script to their server and it's like a ddos attack for them LOL

Incidentally, not so many images have entered since the script was published that could cause this.

Either way, with so many requests, there may be moments of instability. But for now it continues to work normally.





Thanks again to TryNinja for this script, which will certainly be of help.

But, I also ask for understanding for the fact that I had planned a gradual growth, and not a sudden growth due to a similar service going out of business.  ::)
Believe me, I've been making every effort to keep things running, and I'm already planning to reorganize the server.

So far I've managed to keep everything working. Therefore, I appreciate your understanding if there are moments of instability (which I believe were very rare).  ;)



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: pawanjain on May 14, 2023, 01:34:16 PM
Thanks for this work around.  How do I set a specific folder for these legacy images?

I decided to go ahead and get things started.  I swapped out the API for the one I have on my account.  After 185 pages without any activity, this happened:

https://www.talkimg.com/images/2023/05/14/screenshot.3724c7797e1d42f02230.jpeg

...and the script stopped.

How did you get the API key ?

I tried to search for it on the site and even tried to register but couldn't see any options for it anywhere on the site.
I tried running the script in OP but it didn't change any of the images although the script completed without any errors.
So I thought of registering on the site and using it's API and then try running the script.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 14, 2023, 01:41:39 PM
There's already an embedded API key so you don't need to use your own. hOWEVER  if you have contacted Joker to ask to register, then you can get an API key in the settings section.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: NeuroticFish on May 14, 2023, 02:18:53 PM
I didn't look into the script, I just tried to run it by the instructions.
Well... I've got errors like the one from the linked image and... the posts to be edited seem to be TryNinja's :D :D

I guess that it still needs a little work, however, I do like the idea and I appreciate the effort (hence the merit).

PS. Does this also cover the parts of the forum I've posted in the past and now I have them ignored?

https://www.talkimg.com/images/2023/05/14/2023-05-14-17_08_38-Window09edc53d751d3535.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: libert19 on May 14, 2023, 02:29:49 PM
For those who want to run this script on android device can use Eruda browser (https://play.google.com/store/apps/details?id=com.eruda) to do so. Click three dot browser at top right >> run code >> paste script in console.

https://www.talkimg.com/ss.png (https://www.talkimg.com/images/2023/05/14/Screenshot_20230514-193515227935839cbbe830.png)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: NeuroticFish on May 14, 2023, 02:45:16 PM
I will come back to the error I've noticed.
I've seen in the script a part that writes "https://bitcointalk.org/index.php?action=profile;u=557798", which is TryNinja's profile.
The next line is fetching data from there. So yeah, I guess that everybody is trying to copy TryNinja's images  ;)

PS. After changing in the script his user id with mine I stopped getting that error.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 03:19:27 PM
I've seen in the script a part that writes "https://bitcointalk.org/index.php?action=profile;u=557798", which is TryNinja's profile.
The next line is fetching data from there. So yeah, I guess that everybody is trying to copy TryNinja's images  ;)
Yes, forgot to remove my uid from the URL. :P

It should work now.

PS. Does this also cover the parts of the forum I've posted in the past and now I have them ignored?
I'm not sure. Only if they show up on your post history.

edit: ignored boards don't show up, so they aren't covered.

Can we make the process less automatic for members who prefer to manually edit their old posts? I had an idea that you or LoyceV might be able to assist with. For instance, adding a search function for posts with images or Imgur links to ninjastic.space would make it easier for members to manually locate and edit their old posts without relying on an automated script. This could be an additional parameter in the search settings that only displays posts with images. Do you think this would be possible?
Sure, I'll see what I can do.

I am on Firefox using the TOR connection. But interestingly I can not copy and paste the code even anything to my console. What is the mystery?
You need to type "allow pasting" on the Console (notice the alert under the Console tab).



I also decreased the limit from 30 uploads/minute to 20 uploads/minute to hopefully get a lower load on @joker_josue's server.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 03:58:43 PM
I am on Firefox using the TOR connection. But interestingly I can not copy and paste the code even anything to my console. What is the mystery?
You need to type "allow pasting" on the Console (notice the alert under the Console tab).
It's working!!!

http://talkimg.com/images/2023/05/14/working50da09adb1ac91e6.png

465 is the number of images I posted so far on the forum using imgur?
If feels like not even close to what I think the real number should be out of 9815 total posts LOL


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 04:04:05 PM
465 is the number of images I posted so far on the forum using imgur?
If feels like not even close to what I think the real number should be out of 9815 total posts LOL
It's the number of pages you have on your post history (minus ignored boards, maybe? because I see you actually have 491 pages).

Could you check how many pages you see? https://bitcointalk.org/index.php?action=profile;u=662330;sa=showPosts


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 04:09:31 PM
465 is the number of images I posted so far on the forum using imgur?
If feels like not even close to what I think the real number should be out of 9815 total posts LOL
It's the number of pages you have on your post history (minus ignored boards, maybe? because I see you actually have 491 pages).

Could you check how many pages you see? https://bitcointalk.org/index.php?action=profile;u=662330;sa=showPosts
I get caught on the ignore boards in many occasions so far. Yes I have many boards are on ignored and with ignored boards total number of pages are 465. When I am checking it from none logged in browser then I see it's 491. I don't care about the ignored boards though LOL

Thanks for clarification. I was thinking those were number of images.

[edit]
I got error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://talkimg.com/image/UUGNf/delete/eb7edff665a1505b793b77cfb76374db770c993d2420a8d6. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
The learn more link: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default

Followed by the following
Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource.
Code:
<anonymous> debugger eval code:172
    AsyncFunctionNext self-hosted:810
    (Async: async)
    <anonymous> debugger eval code:172
    getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:251
    evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:172
    evaluateJS resource://devtools/server/actors/webconsole.js:960
    evaluateJSAsync resource://devtools/server/actors/webconsole.js:851
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Agbe on May 14, 2023, 04:13:39 PM
1. Goes through all your posts looking for imgur.com direct links (.png|.jpg|.jpeg);
2. Reuploads the image to talkimg.com;
3. Edits the post with the new link.

I don't know if I misunderstood the script here. My question here is that, you are saying we should re-uploads the uploaded images from the imgur links and to talkimg. com but what about the images that are not the device, can they be found? Because the issue now is the images that are not in the hard drive.

Quote
How to use it:

1. Go to bitcointalk.org (any page).
2. Open the browser developer tools on the Console tab (Ctrl+Shift+I or F12).
3. Paste the script and press Enter.
4. Leave the page open while the script runs and, if you can, do not use the forum (not even in other tabs) to avoid rate limiting errors
And the above can only work in computer and not in Android.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 04:15:13 PM
@TryNinja, please check edit of my last post if you missed it already.

[edit]
I got error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://talkimg.com/image/UUGNf/delete/eb7edff665a1505b793b77cfb76374db770c993d2420a8d6. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
The learn more link: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default

Followed by the following
Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource.
Code:
<anonymous> debugger eval code:172
    AsyncFunctionNext self-hosted:810
    (Async: async)
    <anonymous> debugger eval code:172
    getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:251
    evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:172
    evaluateJS resource://devtools/server/actors/webconsole.js:960
    evaluateJSAsync resource://devtools/server/actors/webconsole.js:851
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 04:30:13 PM
I don't know if I misunderstood the script here. My question here is that, you are saying we should re-uploads the uploaded images from the imgur links and to talkimg. com but what about the images that are not the device, can they be found? Because the issue now is the images that are not in the hard drive.
The script grabs the images from the forum and reuploads them on TalkImg.

I got error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://talkimg.com/image/UUGNf/delete/eb7edff665a1505b793b77cfb76374db770c993d2420a8d6. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
It's an error with TalkImg, maybe load related (or joker_josue is trying to fix CORS while we're talking, which would make the script work without my proxy).


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: psycodad on May 14, 2023, 04:45:40 PM
Imgur to TalkImg - automatically fix your broken images

<snip>

Thank you very much for your effort, worked like a charm.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 04:46:27 PM
I got error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://talkimg.com/image/UUGNf/delete/eb7edff665a1505b793b77cfb76374db770c993d2420a8d6. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
It's an error with TalkImg, maybe load related (or joker_josue is trying to fix CORS while we're talking, which would make the script work without my proxy).

I was able to skip the error and rerun the script.

Most possibly when it finds a topic which is locked then from the next step it stops working and shows error.

In my case the error was on the 33rd page [const startPage = 33]
Then I thought to skip the page and started from 34th page [const startPage = 34]


It worked until I got the same error on 78th page.
Code:
[60454365] Uploading image... debugger eval code:138:25
[60454365] Uploaded: https://talkimg.com/images/2023/05/14/blob55aa087fccffd7d7.jpeg debugger eval code:143:29
[60454365] Editing post https://bitcointalk.org/index.php?topic=5404157.msg60454365#msg60454365 debugger eval code:156:25
[60454365] Could not edit post (maybe locked?), deleting uploaded images...
Again skipped the error page and started from 79th page [const startPage = 79]

It's working.

Hopefully it will help for those who are seeing error after running the script for a few minutes.

[edit]
This is my current status
Quote
Getting posts on page 136/465 (29%)




Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 04:58:03 PM
Thanks for this work around.  How do I set a specific folder for these legacy images?
You can now specify the albumId from TalkImg at the top of the script (if you have an account there).

i.e: https://www.talkimg.com/album/XXXX < id



Code:
[60454365] Could not edit post (maybe locked?), deleting uploaded images...
This won't stop the script, so you can ignore it. Or maybe you're still getting the long "Cross-Origin Request Blocked" message everytime it tries to delete the image from TalkImg?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Eternad on May 14, 2023, 05:02:02 PM
The script is very simple and easy to use. It only took a few minutes to finish replacing all my images and it works like magic.


I decided to create a local board version for our board to help my fellow local user to convert all those invalid images from imgur to talking.

Link to PH version: https://bitcointalk.org/index.php?topic=5452715.msg62243640#msg62243640

Thank you @ TryNinja!




Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 05:06:49 PM
Code:
[60454365] Could not edit post (maybe locked?), deleting uploaded images...
This won't stop the script, so you can ignore it. Or maybe you're still getting the long "Cross-Origin Request Blocked" message everytime it tries to delete the image from TalkImg?

Before the script stops or actually doesn't move and show any new status, it shows the above warnings and then the errors. That's why I was assuming it's happening once it's receiving a lock topic [(maybe locked?)]. Every time it stops on the error I increment the const startPage with +1 and works just fine. Right now I am on 167 page out of 465.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 14, 2023, 05:09:34 PM
Folks, I appreciate your interest in the project, but this has escalated a little more than expected.  ::)

I inform you that during the next few hours, there may be some disturbance in the upload of new images. Because I'm doing reconfiguration on the servers and sometimes it can take a few hours.

Thank you for your understanding and patience! As soon as the situation is more normalized, I will let you know.


EDIT: I recommend that you take a break from updating your topics, using this script, until I finish this maintenance that I'm doing, to avoid losing work.
Once again, thank you for your understanding.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 14, 2023, 05:35:23 PM
Sorry for the repeated post. But I suggest a break, because of the maintenance that is being carried out on my server.

Before the script stops or actually doesn't move and show any new status, it shows the above warnings and then the errors. That's why I was assuming it's happening once it's receiving a lock topic [(maybe locked?)]. Every time it stops on the error I increment the const startPage with +1 and works just fine. Right now I am on 167 page out of 465.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 14, 2023, 05:43:55 PM
Sorry for the repeated post. But I suggest a break, because of the maintenance that is being carried out on my server.

Before the script stops or actually doesn't move and show any new status, it shows the above warnings and then the errors. That's why I was assuming it's happening once it's receiving a lock topic [(maybe locked?)]. Every time it stops on the error I increment the const startPage with +1 and works just fine. Right now I am on 167 page out of 465.
I hear you brother. I will be trying it tomorrow again and hoping before that you will be able to fix it. The uploads are definitely creating huge load to your server very similar to a ddos attack if I can relate it


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: yhiaali3 on May 14, 2023, 05:49:02 PM
Thanks @TryNinja for the effort to create this amazing script.
I tried it, at first it worked very well and did a lot of successful substitutions for a lot of the images, but some of the quotes included with the images were not replaced too and I got the following error:

                                              https://www.talkimg.com/images/2023/05/14/1a60da5e828c6b154.jpeg

Then the script stopped working after only completing 21%. I don't know what exactly caused the error, although it worked fine at first?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 05:50:16 PM
Sorry for the repeated post. But I suggest a break, because of the maintenance that is being carried out on my server.
I put your warning at the top of the topic, let me know when we're good to go. Hopefully I didn't break anything. :P

Then the script stopped working after only completing 21%. I don't know what exactly caused the error, although it worked fine at first?
Read joker_josue's reply above.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: krogothmanhattan on May 14, 2023, 06:03:11 PM
Thankyou so much for doing this!  Mine didnt work here is the results for my thread


https://bitcointalk.org/index.php?topic=3315347.0

   I cant post the results from the console as it is too large. Any way I can?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: dimonstration on May 14, 2023, 06:24:31 PM
Fellow android user. You can use this script too using  your mobile phone by installing Kiwi browser. Kiwi browser has a developer feature which allows you to run this script same as using the desktop browser. You just need to make your phone screen on while the script is running to make it continuously running. It will pause when you put the browser in the background or your phone sleep.

This script is a game change for manually changing all the broken images on imgur.  Thanks OP.


Thankyou so much for doing this!  Mine didnt work here is the results for my thread


https://bitcointalk.org/index.php?topic=3315347.0

   I cant post the results from the console as it is too large. Any way I can?

Probably the original image that you used exceeded the 2.5mb max file size of talkimg.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Stalker22 on May 14, 2023, 06:39:06 PM
Sorry for the repeated post. But I suggest a break, because of the maintenance that is being carried out on my server.
I put your warning at the top of the topic, let me know when we're good to go. Hopefully I didn't break anything. :P

Perhaps an even better idea would be to include a pop-up message in the script that displays joker_josue's donation address?

After all, he is working hard to provide us with a server for all our needs, yet it seems like no one even bothers to donate some coins as a token of appreciation for his efforts. Come on, guys! The man deserves at least a beer for his hard work!  ;D


By the way, you deserve a donation as well. I will deal with that as soon as the congestion on the network clears up a bit.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 14, 2023, 06:55:36 PM
I cant post the results from the console as it is too large. Any way I can?
TalkImg uploading is under maintenance, so you can't actually use the script right now.

You should see something like this:
Code:
Could not upload, error: System write error (UPLOAD_ERR_CANT_WRITE)



Perhaps an even better idea would be to include a pop-up message in the script that displays joker_josue's donation address?
You're right. Added!

https://i.ibb.co/25W9wvg/image.png



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: JeromeTash on May 14, 2023, 08:05:14 PM
I haven't checked my whole post history, but the script worked flawlessly for me.

In the version where TryNinja forgot to exclude his user ID, all I did was replace it with mine  ;)

Honestly, I didn't know what I was going to do about changing all my past Imgur linked images to a new image hosting site, but thanks to OP, all is good. Not all Hero wear caps. Respect!

https://i.vgy.me/6Unqwr.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 14, 2023, 08:25:15 PM
Thanks for all your support!
But I really ask for a little patience!

As you can imagine, this morning there were about 1k images on the server, now there are almost 5k.
This is Sunday and I wasn't expecting this increase so fast! Either way I'm doing everything I can to keep everything online.

I ask for your patience and understanding, within a few hours everything should be back to normal.

Now I just need some air...  ::)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 14, 2023, 11:44:03 PM
Thanks for all your support!
But I really ask for a little patience!

As you can imagine, this morning there were about 1k images on the server, now there are almost 5k.
This is Sunday and I wasn't expecting this increase so fast! Either way I'm doing everything I can to keep everything online.

I ask for your patience and understanding, within a few hours everything should be back to normal.

Now I just need some air...  ::)

We really appreciate your time and effort - this is a Hurculean task with a sence of urgency, so hang in there - it's greatly appreciated.




Is there any way to slow down the fetching?  I've shut down the page the code was running on ("stop" didn't seem to work) as I was getting these errors:

https://www.talkimg.com/images/2023/05/15/screenshot.3726f4dbf6ca745476a1.jpeg




I haven't checked my whole post history, but the script worked flawlessly for me.

In the version where TryNinja forgot to exclude his user ID, all I did was replace it with mine  ;)

Yes, I did the same thing - I'm not a coder, so I never even looked at the code.  I just assumed being logged in was enough, but when I changed it to 131361 - IT WORKED!!


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 12:51:44 AM
I would like to share here the status of the maintenance that I am carrying out:

SITUATION STATUS:
Because of the changes that have occurred recently with the Imgur service, there has been a significant increase in TalkImg usage. As you can guess, I had anticipated a gradual increase in usage, not a sudden increase like it has been these past few days. This forced us to readjust plans and move forward with updates to the server earlier than expected.

I have for the past 24 hours made every effort to keep everything up and running. And luckily, I've been able to keep everything up and running. Thank you for all the support and understanding you have given me.

The upgrade process is not over yet, as a new server is being set up for the ImgTalk project. While this process takes place and in order to keep the service online, I inform you that you can upload images, but to maintain stability, each IP can only upload 50 images per hour.

Over the next few hours, I'll be updating the process.
Once again I ask for everyone's understanding, in helping to keep everything working.

Once again thank you for your understanding, and I hope to have everything back to normal within a few hours.
Soon more news.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 15, 2023, 01:34:34 AM
Once again thank you for your understanding, and I hope to have everything back to normal within a few hours.
Soon more news.

The script I ran was able to port about 35 images before it crashed (I'm sorry to say I didn't see your notification earlier) - I've had a look and the images are now working!  I've also noticed that the images are being ported from most recent backwards through time.  Was this a conscious decision, or it just happened that way?

Kudos for all your work, the both of you.




The upgrade process is not over yet, as a new server is being set up for the ImgTalk project. While this process takes place and in order to keep the service online, I inform you that you can upload images, but to maintain stability, each IP can only upload 50 images per hour.

Can the script be slowed down to one page (i.e. 20 posts) per minute?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Kryptowerk on May 15, 2023, 02:45:21 AM
Thanks for creating and providing this script. If it works it will spare me hours upon hours - much appreciated.
Will be able to try out in 2 days and then report back on how it went.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 08:01:02 AM
Thanks for creating and providing this script. If it works, it will spare me hours upon hours - much appreciated.
Will be able to try out in 2 days and then report back on how it went.


Sadly, imugur is going to delete pictures today, unless you uploaded those via an account.
I have just discovered this tool. I will try to run it asap.


I am running now. I get errors as I am uploading too many images (more than 50 images per hour).
Are there any alternative ways of running it?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 08:34:19 AM
I am running now. I get erroes as I am uploading too many images (more than 50 images Per hours).
IS there any alternative ways of running it?

I ask you to wait a little longer to carry out this transaction process.
As far as I know, this script uses a TryNinja proxy, so it's always using the same IP.

As I said, I'm upgrading the server and in order not to lose information, I have to control the flow of uploads. I hope you understand the situation. In a few hours, I hope to have the situation more normalized.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 08:36:39 AM
I am running now. I get errors as I am uploading too many images (more than 50 images per hour).
Are there any alternative ways of running it?

I ask you to wait a little longer to carry out this transaction process.
As far as I know, this script uses a TryNinja proxy, so it's always using the same IP.

As I said, I'm upgrading the server and in order not to lose information, I have to control the flow of uploads. I hope you understand the situation. In a few hours, I hope to have the situation more normalized.

Thank you very much for all you guys are doing.
Hopefully in a few hours images will still be available on imgur website!


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 15, 2023, 08:38:34 AM
Sadly, imugur is going to delete pictures today, unless you uploaded those via an account.
Who's going to secure images on the Investigations (https://bitcointalk.org/index.php?board=227.0) board? I never scraped that board.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 09:18:17 AM
Sadly, imugur is going to delete pictures today, unless you uploaded those via an account.

Can you indicate more or less how many images you have to carry out the process?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 09:24:45 AM
Sadly, imugur is going to delete pictures today, unless you uploaded those via an account.

Can you indicate more or less how many images you have to carry out the process?

I would say a few thousands. I have 12k posts, my guesstimate is around a third post with images. This means 4k images.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 15, 2023, 09:30:57 AM
I have 12k posts, my guesstimate is around a third post with images. This means 4k images.
How often did you add images by editing your post? I won't have those, but I should have the majority.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 09:33:03 AM
I have 12k posts, my guesstimate is around a third post with images. This means 4k images.
How often did you add images by editing your post? I won't have those, but I should have the majority.

Not that often I think.
The vast majority of posts have images already included.
But I am confident about @joker_josue will finish his mantenaince before it’s too late, and I will be able to use his script.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 09:35:10 AM
I would say a few thousands. I have 12k posts, my guesstimate is around a third post with images. This means 4k images.

But I am confident about @joker_josue will finish his mantenaince before it’s too late, and I will be able to use his script.

Yeah... it might be a little high flow, for this moment of changes in the server.
I'll see what I can do in the meantime. (I sent PM)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 15, 2023, 09:56:26 AM
Since there is a risk (?) of imgur deleting images today, I decided to add ImgBB as a image provider while TalkImg is under maintenance.

Just change the field "provider" at the top to "imgbb" (IMPORTANT: ALL LOWERCASE) and add your account's API key just a few lines below (providers -> imgbb -> apiKey).

Example:

Code:
const provider = 'imgbb'

Code:
imgbb: {
    url: 'https://api.imgbb.com/1/upload',
    apiKey: 'YOUR-API-KEY',
    uploadsPerMinute: 10,
    deleteOnError: false,
}

Run the script and the images will be uploaded to imgbb + your posts updated.

The script is now published (and will be updated) here: https://gist.github.com/ninjastic/36c14fb2eb1c4b750f40f332d408688f



People who are making translations and/or posting on their own local threads, please don't put the code directly on your local threads since I'm always fixing something here or there and your code will most likely be outdated. Instead, link this thread and tell people to get the code from here.

cc @Eternad @Charles-Tim (which I saw posting the script somewhere else)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 15, 2023, 10:11:51 AM
Since there is a risk (?) of imgur deleting images today, I decided to add ImgBB as a image provider while TalkImg is under maintenance.

Just change the field "provider" at the top to "imgbb" (IMPORTANT: ALL LOWERCASE) and add your account's API key just a few lines below (providers -> imgbb -> apiKey).

Example:

Code:
const provider = 'imgbb'

Code:
imgbb: {
    url: 'https://api.imgbb.com/1/upload',
    apiKey: 'YOUR-API-KEY',
    uploadsPerMinute: 10,
    deleteOnError: false,
}

Run the script and the images will be uploaded to imgbb + your posts updated.

The script is now published (and will be updated) here: https://gist.github.com/ninjastic/36c14fb2eb1c4b750f40f332d408688f



People who are making translations and/or posting on their own local threads, please don't put the code directly on your local threads since I'm always fixing something here or there and your code will most likely be outdated. Instead, link this thread and tell people to get the code from here.

cc @Eternad @Charles-Tim (which I saw posting the script somewhere else)
Good job brother.

Questions:
How do I get the API Key of imgbb. I did not need it yesterday though. It seems I need to register with them. Hopefully there is a chance to skip it.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 15, 2023, 10:13:05 AM
How do I get the API Key of imgbb. I did not need it yesterday though. It seems I need to register with them. Hopefully there is a chance to skip it.
1. Create your account: https://imgbb.com/signup
2. Go to the API page and click "Get API key": https://api.imgbb.com


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 15, 2023, 10:22:26 AM
How do I get the API Key of imgbb. I did not need it yesterday though. It seems I need to register with them. Hopefully there is a chance to skip it.
1. Create your account: https://imgbb.com/signup
2. Go to the API page and click "Get API key": https://api.imgbb.com


If I understand correctly, I did everything correctly.

https://i.ibb.co/WW6gH46/c.png

What am I missing now?

I see a problem, though it's about registering with imgbb but let's figure out how to run the script properly then we can talk about that later.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 15, 2023, 10:25:23 AM
What am I missing now?
Go to https://bitcointalk.org/index.php?action=profile;sa=showPosts

How many pages do you see? And which browser are you using?

Feel free to message me over telegram @TryNinja so we can debug this faster.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 15, 2023, 10:33:06 AM
What am I missing now?
Go to https://bitcointalk.org/index.php?action=profile;sa=showPosts

How many pages do you see? And which browser are you using?

Feel free to message me over telegram @TryNinja so we can debug this faster.
I don't use scammers heaven LOL

By the way, it's working fine now. It seems you also worked on the error handling about the pages which are locked. Let's hope I am able to update all posts that is containing images out of 10K plus posts 🤣

The account on imgbb.
I created an account with a temp email which means after making this update once I will close my browser I will forget about it. In that case if imgbb close the account for inactivity then it seems all the images uploaded from this account will be removed [Possibly]. We really need talkimg to comeback and able to take loads.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: entebah on May 15, 2023, 12:19:12 PM
i just try the script and i add my API from ImgBB but it's still not working for me.
i use google chrome and the number of pages shown in the script is correct.
On which steps that i got wrong? or is it just all the image already got deleted?
https://i.ibb.co/Fn7QdCd/image.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: babo on May 15, 2023, 12:52:03 PM
very good code, i am just curious and inspect it on gist

clean coded and do everything

one stuff not convincing me: edit

probably is usefull a "not edit version" without edit for permit folks like me help guy like fillippone

or better a useful solution is upload a image like imgur.com/blabla111.jpg in talkimg.com/blabla111.jpg with same hashid/userid for easy transation from fucking-imgur and new service

just my two cents


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 02:00:31 PM
I would also like to share here the latest update about the TalkImg.com server update process:

SITUATION STATUS:
I'm on the final face of the server upgrade process. I will now start migrating data to the new server.
To ensure that no images are lost during this process, uploads will be paused.

In this sense, during the next few hours, it will not be possible to make new uploads. But, the images continued to function normally in the forum. There will be no problems displaying the images.

Once again, thank you for your understanding. Soon everything will be back to normal.



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: cygan on May 15, 2023, 02:08:16 PM
the script ended with me immediately after the execution.
an imgbb account is available and was together with the api key in the script - anyone an idea what it can be? ::)

https://i.ibb.co/gjdGrgT/Screenshot-2023-04-30-202808.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 15, 2023, 02:17:54 PM
the script ended with me immediately after the execution.

Uploads are paused.  Try again later.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 15, 2023, 02:38:18 PM
I would also like to share here the latest update about the TalkImg.com server update process
Looking forward to it. Good luck brother.

@TryNinja, finally it's all done!

https://i.ibb.co/GTxnbpT/end.png

Hell! It's a lot of work that was done by the script. 10K plus posts! Quite an achievement to be honest.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: babo on May 15, 2023, 03:02:00 PM
I would also like to share here the latest update about the TalkImg.com server update process
Looking forward to it. Good luck brother.

@TryNinja, finally it's all done!

https://i.ibb.co/GTxnbpT/end.png

Hell! It's a lot of work that was done by the script. 10K plus posts! Quite an achievement to be honest.

just i am curios, time for do this?
10k posts is so much :D

anyway is a great job about talkimg owner and about tryninja
fillippone have a crisis when imgur decide to delete all images and :) this save the day

when i have merits i distribute to talkimg owner and tryninja :D


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 03:05:37 PM
I would also like to share here the latest update about the TalkImg.com server update process
Looking forward to it. Good luck brother.

@TryNinja, finally it's all done!

https://i.ibb.co/GTxnbpT/end.png

Hell! It's a lot of work that was done by the script. 10K plus posts! Quite an achievement to be honest.

just i am curios, time for do this?
10k posts is so much :D

anyway is a great job about talkimg owner and about tryninja
fillippone have a crisis when imgur decide to delete all images and :) this save the day

when i have merits i distribute to talkimg owner and tryninja :D

I have done 25% of the job in 4 hours.
Waiting for talkimg to resume uploads, as I hit some kind of threshold on imgbb and I cannot upload there anymore.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 15, 2023, 05:50:02 PM
A new error with imgbb.

I was uploading safely (using a secondary account), then this happened

Code:
[Log] [59012837] Uploading image...
[Log] [59012837] Uploaded: – "https://i.ibb.co/rZHN4sM/59012837.png"
[Log] [59012837] Uploading image...
[Error] Origin https://bitcointalk.org is not allowed by Access-Control-Allow-Origin. Status code: 502
[Error] Fetch API cannot load https://api.imgbb.com/1/upload?key=MY API KEY***CENSORED*** due to access control checks.
[Error] Failed to load resource: Origin https://bitcointalk.org is not allowed by Access-Control-Allow-Origin. Status code: 502 (upload, line 0)
[Error] Unhandled Promise Rejection: TypeError: Load failed


Is imgbb blocking bitcointalk as well?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 15, 2023, 08:00:24 PM
I would like to inform you that the service is already working normally!
Learn more here. (https://bitcointalk.org/index.php?topic=5450546.msg62249204#msg62249204)

I just ask you to remember that although the migration is complete, some adjustments may still arise. Therefore, use the tool in moderation.  :P ::) ;D


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Timelord2067 on May 16, 2023, 02:43:14 AM
I've used the original script and the latest script as well as changing the API key to my own.

I get the same error messages after a half dozen pages:

Code:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://talkimg.com/image/agViw/delete/b8ed615e3cd6fbceb9dad6a9cda04996745632ff99b5b22a. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource. debugger eval code:237:13

I jump to the next page and start again and another half dozen or so pages, I get the same error message.

I'm sloooowly going through my pages (am up to 25% of the way through) but it is teedious to have to sit with the script and restart it every few minutes.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: pawanjain on May 16, 2023, 04:08:43 AM
I get the same error messages after a half dozen pages:

A new error with imgbb.

May be because you are using imgbb to upload the images. I just completed all my uploads using the script and it was flawless.
I changed the providers to talkimg and then started uploading and in few minutes it was done.

Code:
    
    // options
    const startPage = 1
    const provider = 'talkimg'



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 16, 2023, 05:05:30 AM
~
I just updated the script. Now it checks if the topic is locked before uploading any image, which should drastically lower the chances of this error happening.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: babo on May 16, 2023, 06:27:33 AM
~
I just updated the script. Now it checks if the topic is locked before uploading any image, which should drastically lower the chances of this error happening.


nice job man
what do you think about my ideas/proposals?
- enable edit view with flag true/false
- permit to change name (we need this option on talkimg) for mantain similar hashname from xx provider to talkimg

i think are good ideas


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: shahzadafzal on May 16, 2023, 07:03:25 AM
Excellent work TryNinja I love the bitcointalk community how they come to rescue every time :)

I test run it on my few posts and it worked fine. Will run it on all my posts later, probably tonight :)

Again big thanks to joker_josue too.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: BitcoinGirl.Club on May 16, 2023, 08:41:54 AM
I would also like to share here the latest update about the TalkImg.com server update process
Looking forward to it. Good luck brother.

@TryNinja, finally it's all done!

https://i.ibb.co/GTxnbpT/end.png

Hell! It's a lot of work that was done by the script. 10K plus posts! Quite an achievement to be honest.

just i am curios, time for do this?
10k posts is so much :D

anyway is a great job about talkimg owner and about tryninja
fillippone have a crisis when imgur decide to delete all images and :) this save the day

when i have merits i distribute to talkimg owner and tryninja :D

I have done 25% of the job in 4 hours.
Waiting for talkimg to resume uploads, as I hit some kind of threshold on imgbb and I cannot upload there anymore.
I don't know how long it took but I was online yesterday for around 5 to 6 hours and the script was running while my laptop was on. So more or less it took similar amount of time for me yesterday.

The day before yesterday I was online for few hours and until the update was taking place by joker_josue my system was busy. All together I would say it took 8 to 10 hours to finish the whole update.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: fillippone on May 16, 2023, 12:04:37 PM

Code:
    
    // options
    const startPage = 1
    const provider = 'talkimg'



Of course, I set the parameters correctly with a freshly generated API from a new account.

I finished uploading every possible image to talkimg, only a few left above the 2MB threshold, so I wanted to have a second round with imgbb.

Apparently still the uploading error I had the other day

Code:
[Log] [59506339] Uploading image...

[Error] Origin https://bitcointalk.org is not allowed by Access-Control-Allow-Origin. Status code: 502

[Error] Fetch API cannot load https://api.imgbb.com/1/upload?key=myotherapi due to access control checks.

[Error] Failed to load resource: Origin https://bitcointalk.org is not allowed by Access-Control-Allow-Origin. Status code: 502 (upload, line 0)

[Error] Unhandled Promise Rejection: TypeError: Load failed




Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: pawanjain on May 16, 2023, 01:10:42 PM

snip


Of course, I set the parameters correctly with a freshly generated API from a new account.

I finished uploading every possible image to talkimg, only a few left above the 2MB threshold, so I wanted to have a second round with imgbb.

Apparently still the uploading error I had the other day

Code:
[Error] Origin https://bitcointalk.org is not allowed by Access-Control-Allow-Origin. Status code: 502


Error 502 means that there's an error from the server side. When I digged up I found that we get this error when appropriate CORS (Cross-Origin Resource Sharing) headers are not set on the domain.
So the API request in the above script is being blocked by the browser and there are only two solutions for this.

1. The server side configuration has the appropriate CORS headers set and allows requests from bitcointalk
2. Get a proxy or server side endpoint which allows us to bypass CORS restrictions

So I guess it won't be possible on imgbb since we don't have anyone from server side to allow the above configuration.
May be joker_josue can help in here to increase the max limit size for the uploads or provide specific endpoint which allow increased max limit size to specific users.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 16, 2023, 02:39:52 PM
So I guess it won't be possible on imgbb since we don't have anyone from server side to allow the above configuration.
May be joker_josue can help in here to increase the max limit size for the uploads or provide specific endpoint which allow increased max limit size to specific users.

I've been having trouble configuring CORS, but working on it.
That's why TryNinja has implemented a proxy that helps. We have to wait for him to see if the last changes I made will work.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: AB de Royse777 on May 16, 2023, 03:47:43 PM
Possible to have another script only for single thread, reply etc?

The locked threads are not updating, I have many of them. The script will help to update individual threads when browsing the threads in the future.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: sujonali1819 on May 16, 2023, 06:42:45 PM
Thank you for your awesome work. It's incredible. I have tried to use the script today. Here are some issues that I face.

I got an error like File is larger than 2mb or something like this. I forget to take a screenshot. But it's sure the photos were not more than 2mb since the forum does not support it.

Another issue is the script is counting an emoji ex. (:)) as a photo. and it also tries to change it. That means if you use any emoji in your title or in the post it will be changed with some unreadable characters.

See here my title has changed:

https://www.talkimg.com/images/2023/05/16/image729d976dfcfb26ea.png

What was like this:

https://www.talkimg.com/images/2023/05/16/image14d719a8a0a37df3.png


I am worried about the emojis, Many times I used these emojis in my post. They will look strange now. Please try to do something so that it gets auto-fixed.





Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: OgNasty on May 16, 2023, 07:22:42 PM
I haven’t had a chance to check this out yet as I am just stumbling upon it, but it seems like a great tool to keep the integrity of older posts.

My immediate thoughts are if this could be run with Administrator privileges forum wide so that all images could be corrected for everyone at once. I don’t know if TalkImg would even want that, but it would be cool. 


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 16, 2023, 08:35:11 PM
I am worried about the emojis, Many times I used these emojis in my post. They will look strange now. Please try to do something so that it gets auto-fixed.
Thank you! My biggest concern was making sure posts and titles don't get messed up, but I totally forgot to test some emojis (very complicated to deal with...). :P :(

It should be fixed now.

Another issue is the script is counting an emoji ex. (:)) as a photo.
It was an encoding issue, actually. Emojes can be a bit complicated but I found a solution.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: cygan on May 17, 2023, 03:58:15 PM
i have now also run the script overnight and the whole procedure was completed properly. however, i have the following problem in one of my threads ([INFO] CCC - cygan's crypto collection - constantly updated (https://bitcointalk.org/index.php?topic=5275792.0)), that not all imgur images/links have not been converted into imgbb images/links.
when i open the thread the new imgbb images are shown to me and the rest (old imgur images) are not

anyone a solution how i can update this again using this script?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 17, 2023, 10:36:34 PM
"Single Topic" version

Get the code here: https://gist.github.com/ninjastic/59bde80306c32153a5775b9a570b16b7

Run it on any topic and all images posted by you will be updated.

IMPORTANT: only images that are shown on the screen! This means that if you are on page 1, the script won't update the images on page 2. You can use the ;all page on the forum to make all posts show up all at once (probably won't work properly if the topic is huge?).



not all imgur images/links have not been converted into imgbb images/links.
when i open the thread the new imgbb images are shown to me and the rest (old imgur images) are not
Try the above script.

cc @Royse777


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 17, 2023, 10:55:03 PM
"Single Topic" version

Get the code here: https://gist.github.com/ninjastic/59bde80306c32153a5775b9a570b16b7

Run it on any topic and all images posted by you will be updated.

IMPORTANT: only images that are shown on the screen! This means that if you are on page 1, the script won't update the images on page 2. You can use the ;all page on the forum to make all posts show up all at once (probably won't work properly if the topic is huge?).

Does it only work if the images are on Imgur?
Imagine that I have images on Imgbb and I want to transfer them to TalkImg, is it possible?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Husna QA on May 18, 2023, 02:41:04 AM
One of the bugs that I encountered in several posts, as shown in the following screenshot:

https://www.talkimg.com/images/2023/05/18/Screen-Shot-2023-05-18-at-09.41.509ee83217e832776d.png (https://www.talkimg.com/image/d4F8c)

Post links: https://bitcointalk.org/index.php?topic=5196950.msg52918008#msg52918008

All BBCode is visible on the post. Usually, it appears when the post is still being edited.


Earlier, I tried to edit a post similar to that manually and immediately saved it again without making any changes to the content and code of the post, for example, this post:
[Edukasi] Privasi dan Anonimitas Bitcoin (https://bitcointalk.org/index.php?topic=5137011.0)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 18, 2023, 06:18:14 AM
All BBCode is visible on the post. Usually, it appears when the post is still being edited.
Sorry, that was my bad. I was trying to fix the emojis and broke the bbcodes for a moment. Fixed just a moment later but you were one of the victims. :P

Here is yet another script that should fix your posts with broken bbcode: https://gist.github.com/ninjastic/d560848568339e5a2d7a25ddffb578d5

All it does is find those posts and refresh them (a.k.a edit without any change).


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Husna QA on May 18, 2023, 08:52:17 AM
All BBCode is visible on the post. Usually, it appears when the post is still being edited.
Sorry, that was my bad. I was trying to fix the emojis and broke the bbcodes for a moment. Fixed just a moment later but you were one of the victims. :P

Here is yet another script that should fix your posts with broken bbcode: https://gist.github.com/ninjastic/d560848568339e5a2d7a25ddffb578d5

All it does is find those posts and refresh them (a.k.a edit without any change).
Thanks, TryNinja, for the script to fix the broken post.
Previously, I thought Bitcointalk needed time to refresh the display of posts, as when changing avatars, which sometimes took several minutes.

But after a day has passed, it still hasn't been updated. I had time to edit (without any changes) manually on several posts that I found were broken.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: libert19 on May 18, 2023, 01:41:56 PM
I'm getting this error.

https://www.talkimg.com/images/2023/05/18/Screenshot_20230518-191037278e787374353f4be.png



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: NeuroticFish on May 18, 2023, 06:30:20 PM
I've just got a different one:

https://www.talkimg.com/images/2023/05/18/2023-05-18-21_27_43-Windowca6678d28651442d.png


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 18, 2023, 08:39:15 PM
Run it again. The script requires loading a full emoji regex to match and not break them: https://raw.githubusercontent.com/mathiasbynens/emoji-test-regex-pattern/main/dist/latest/javascript.txt

TalkImg API returned an error, let me know if you're still getting this.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: libert19 on May 19, 2023, 02:27:09 AM
Run it again. The script requires loading a full emoji regex to match and not break them: https://raw.githubusercontent.com/mathiasbynens/emoji-test-regex-pattern/main/dist/latest/javascript.txt

When if I try to open mentioned link manually, I get same timeout error in browser.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: NeuroticFish on May 19, 2023, 08:00:11 PM
TalkImg API returned an error, let me know if you're still getting this.

No. I've ran it again right after that and it managed to handle all the pages of my history without errors (well, excepting a few too large images and a couple of locked topics, but it's okay).
Sorry for the late answer and thanks.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: libert19 on May 21, 2023, 05:14:51 AM
Run it again. The script requires loading a full emoji regex to match and not break them: https://raw.githubusercontent.com/mathiasbynens/emoji-test-regex-pattern/main/dist/latest/javascript.txt

When if I try to open mentioned link manually, I get same timeout error in browser.

It's still same to me, neither link works nor script, why isn't there response to this yet?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 21, 2023, 08:07:50 AM
It's still same to me, neither link works nor script, why isn't there response to this yet?
It's just a github file which is valid and working. The issue is on your end (either your browser or your connection?).

But anyways, I edited the script and put the link behind my proxy. See if it works: https://proxy.ninjastic.space/?url=https://raw.githubusercontent.com/mathiasbynens/emoji-test-regex-pattern/main/dist/latest/javascript.txt


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 22, 2023, 06:24:05 AM
Imagine that I have images on Imgbb and I want to transfer them to TalkImg, is it possible?
Forgot to reply this one, sorry.

Yes, you can. I've added a imageLinkRegex variable at the top. It currently only matches imgur links ending with png, jpg, jpeg (edit: and gif).

If you want to match ONLY imgbb images, you can use:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)/gi

If you want to match BOTH imgbb and imgur images:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)|https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 22, 2023, 06:49:43 AM
Yes, you can. I've added a imageLinkRegex variable at the top. It currently only matches imgur links ending with png, jpg, jpeg.

Thanks for the tip.
As soon as I have some time I will test it and give feedback.  ;)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 22, 2023, 07:33:48 AM
It currently only matches imgur links ending with png, jpg, jpeg.
If you add .gif you have everything :)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 22, 2023, 07:40:02 AM
If you add .gif you have everything :)
I removed it because most .gif links posted by me were hitting TalkImg's size limit... but I guess it makes sense to include them by default anyway.

From:
Code:
/https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg)/gi

To:
Code:
/https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 22, 2023, 08:35:51 AM
I removed it because most .gif links posted by me were hitting TalkImg's size limit...
In all files I've downloaded from imgur (https://bitcointalk.org/index.php?topic=5453227.0), about 5% of the .gif files is above the size limit.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 22, 2023, 09:42:29 AM
I removed it because most .gif links posted by me were hitting TalkImg's size limit... but I guess it makes sense to include them by default anyway.

Just remember that the limit is the forum proxy itself. TalkImg can be any size, but as it wouldn't work on the forum, it's not worth uploading. ::)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on May 22, 2023, 09:48:52 AM
Just remember that the limit is the forum proxy itself. TalkImg can be any size, but as it wouldn't work on the forum, it's not worth uploading. ::)
I know that. I believe the image was only linked (not embedded through the [img] tag), so it wasn't using the forum proxy. The script looks for all links (embedded or not), so it was trying to upload it anyway.

I still think it's worth uploading it, since imgur could delete our images at any time.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 22, 2023, 10:41:27 AM
the image was only linked (not embedded through the [img] tag)
~
I still think it's worth uploading it, since imgur could delete our images at any time.
Good point, I only downloaded the embedded images, but links might contain some forum history too.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 22, 2023, 10:42:27 AM
I know that. I believe the image was only linked (not embedded through the [img] tag), so it wasn't using the forum proxy. The script looks for all links (embedded or not), so it was trying to upload it anyway.

I still think it's worth uploading it, since imgur could delete our images at any time.

Right... I hadn't thought about that perspective.

What size could be reasonable to allow uploading? Do you think 5MB would be acceptable?
@LoyceV based on your collection, what value do you think is reasonable?


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on May 22, 2023, 11:25:02 AM
What size could be reasonable to allow uploading? Do you think 5MB would be acceptable?
@LoyceV based on your collection, what value do you think is reasonable?
You decide: here's the 10,000 largest images (http://tmp.loyce.club/largestfirst.html). Check a few of them, and see if they're worth saving. Judging by the file size, I already see a few duplicates.

If you allow images >2.5MB, you shouldn't provide [img]-tags for them, and add a warning that it can only be linked.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on May 22, 2023, 11:41:59 AM
You decide: here's the 10,000 largest images (http://tmp.loyce.club/largestfirst.html). Check a few of them, and see if they're worth saving. Judging by the file size, I already see a few duplicates.

If you allow images >2.5MB, you shouldn't provide [img]-tags for them, and add a warning that it can only be linked.

Yeah... I think it's better to guarantee the limit, for a better forum experience.
Larger images are linked by the forum as external links/files, so each one manages this as they see fit.

Perhaps if in the future I manage to add some warning element in this regard, I will try to do so.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on June 02, 2023, 06:44:13 PM
Imgur images are broken again! Feel free to use the script if you haven't already.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: STT on June 06, 2023, 01:11:45 AM
Is that a 138meg .gif   :D     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LoyceV on June 06, 2023, 06:48:16 AM
Is that a 138meg .gif   :D     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.
The fact that it's 36 years old and still in use, means it's a good thing to keep. I recently tested it (https://bitcointalk.org/index.php?topic=5452425.msg62231787#msg62231787), and for the right images it still produces smaller files than .png. So let's keep .gif :)


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on June 06, 2023, 07:59:55 AM
Is that a 138meg .gif   :D     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.
The fact that it's 36 years old and still in use, means it's a good thing to keep. I recently tested it (https://bitcointalk.org/index.php?topic=5452425.msg62231787#msg62231787), and for the right images it still produces smaller files than .png. So let's keep .gif :)

And don't forget that GIF is a framed image file, which is used to create moving images. So it turns out to be a different file type than a PNG or JPEG.

Now, speaking of history...  ::)
JPEG was created in 1992
And PNG was created in 1996

Another curiosity is that the PNG was created because of copyright issues with the GIF. The GIF files had used the LZW compression technique which was patented by another company. This has led to many companies having to pay to use GIF files. Only private individuals or non-profit institutions could use the GIF without paying.

That happened in 1994. At the time, GIF was the most used type of image on the internet, it took up less space than JPG and had adequate quality for the time. All this patent problem, motivated several developers to work on a new image format, which was able to compress images more and with better quality, the PNG. The next step was for browsers to accept this new format, which thanks to Microsoft and Netscape, with their browsers, made PNG become popular on websites.

At that time, two interesting online movements emerged:
"Burn All GIFs" - What motivated people to stop using the GIF and how to send thousands of emails to the company that had the patent.
"PNG's not GIF" - Which motivated people to use PNG instead of using GIF.

In 2004 the patent ceased to be valid and everyone can freely use GIFs.
Perhaps this was one of the first moves against patent lobbying done online.



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: yahoo62278 on June 07, 2023, 08:56:45 PM
Just spent the last 2 and a half hours running the script. 506 pages later and my images appear to have reappeared lol. Great job @TryNinja everything worked great.

Also want to say thank you to joker_josue for talkimg as that's the image site I used.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: dragonvslinux on September 10, 2023, 03:39:47 PM
Just used this script (better late than never I figured) and can also say it worked very well. Quite a lot of API rate limiting pauses but I guess this is to be expected using the key provided, or in general maybe. Ideally there would have been an option to ignore all images I've posted to Wall Observer, as that would have saved most of the work, but the script got the job done in the end regardless.

There were also some instances of images being uploaded, but then due to locked topic no post was edited, I assume this is where you are the OP you locked the topic maybe? I didn't generally find this happened with images in locked topics overall, just a few instances. Even when re-running the script it would still re-upload the images but be unable to edit the post... maybe this has already been discussed though.



Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LTU_btc on September 10, 2023, 10:49:06 PM
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:
https://talkimg.com/images/2023/09/10/mx4uG.png
Will try to run script again tomorrow, though most of remaining images isn't relevant anymore


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: dragonvslinux on September 11, 2023, 01:27:55 PM
Is it possible that this script would work for tradingview images as well if I changed imgur to tradingview? I noticed a lot of these disappeared out of older topics around the same time as the imgur situation, whereas the images themselves are still available via TV. I assume it'd be imageLinkRegex and decodeProxyImages lines of code that needs changing if so?

The strange thing is TV images are still working on the forum, but it seems that images prior the changes have been affected nonetheless, so ideally it'd also only change the broken ones.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on September 11, 2023, 06:15:54 PM
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:

Weird... I don't have any limits imposed on uploading.  :-\
If you experience this type of situation again, let us know.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: LTU_btc on September 11, 2023, 09:43:38 PM
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:

Weird... I don't have any limits imposed on uploading.  :-\
If you experience this type of situation again, let us know.
Today I tried to run script again to replace remaining images and now everything worked fine, remaining images were replaced just in few minutes. Have no idea why scripto stopped yesterday.
@TryNinja, thanks for this script, without it I wouldn't bother to replace my images manually.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on September 20, 2023, 12:36:38 AM
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on September 20, 2023, 02:33:42 AM
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...
Of course! Go for it.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on September 20, 2023, 06:49:33 AM
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...
Of course! Go for it.

Thanks! I didn't want to abuse it.

Soon we will have something new, which I believe will be something that everyone will like.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Pmalek on November 12, 2023, 12:11:16 PM
Hi TryNinja,
I tried the script today and it works really well. After a quick check, it seems to have replaced all my old Imgur images with new TalkImg links.
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well. 


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on November 12, 2023, 12:27:57 PM
Hi TryNinja,
I tried the script today and it works really well. After a quick check, it seems to have replaced all my old Imgur images with new TalkImg links.
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well.  

As far as I know, just change the host address and the result will be the same. Try adjusting this line:
Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

I don't know if it works on this host, but I know it worked on others. Try it.


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Pmalek on November 12, 2023, 01:23:24 PM
As far as I know, just change the host address and the result will be the same. Try adjusting this line:
Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

I don't know if it works on this host, but I know it worked on others. Try it.
Let's wait for TryNinja just in case. I guess the API key needs to be updated as well. If you use imgbb, you need to edit the API key in the code and enter your own. The API code is already set by default for your site, TalkImg, but it can also be edited. vgy.me surely has unique API codes as well. 


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: joker_josue on November 12, 2023, 04:32:41 PM
Let's wait for TryNinja just in case. I guess the API key needs to be updated as well. If you use imgbb, you need to edit the API key in the code and enter your own. The API code is already set by default for your site, TalkImg, but it can also be edited. vgy.me surely has unique API codes as well. 

The API code is just for the script to upload to TalkImg.
The script does not use other API codes, it just takes the image link and sends it to TalkImg via API.


Note this explanation:
Imagine that I have images on Imgbb and I want to transfer them to TalkImg, is it possible?
Forgot to reply this one, sorry.

Yes, you can. I've added a imageLinkRegex variable at the top. It currently only matches imgur links ending with png, jpg, jpeg (edit: and gif).

If you want to match ONLY imgbb images, you can use:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)/gi

If you want to match BOTH imgbb and imgur images:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)|https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: TryNinja on November 12, 2023, 04:34:38 PM
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well.  
Yes, there is.

joker_josue is correct. The following line is used to grab the images which are then uploaded to talkimg:

Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

For vgy.me, you would probably use:

Code:
const imageLinkRegex = /https:\/\/vgy\.me\/.*?\.(png|jpg|jpeg|gif)/gi

Or for both imgur and vgy.me:

Code:
const imageLinkRegex = /https:\/\/vgy\.me\/.*?\.(png|jpg|jpeg|gif)|https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi


Title: Re: [Script] Imgur to TalkImg - automatically fix your broken images
Post by: Pmalek on November 12, 2023, 06:08:13 PM
OK, it worked to some degree. The images that are still available and uploaded on vgy.me are now available with a TalkImg link. But it seems that for some reason vgy.me deleted most of the images I uploaded years ago. Those are unfortunately lost now. But that's not something that you can do anything about.

Excellent service, thanks a lot!