Pages:
Author

Topic: [Script] Imgur to TalkImg - automatically fix your broken images (Read 2231 times)

legendary
Activity: 2730
Merit: 7065
TryNinja, I would like to make you aware of a bug in your code which affects the script, making image replacement unsuccessful. As @PowerGlove wrote in this post, his Post History fix makes your script not capable of doing what it's supposed to do. But if you change one line of code as described in the post, it will work again.
legendary
Activity: 2282
Merit: 3014
Any guidance would be much appreciated!  I have quite a few topics I worked hard on that need to img fixed and would sldo benefit those down the road to stay looking nice (here's what I tried to work on- https://bitcointalksearch.org/topic/historical-timeline-of-the-physical-bitcoin-cryptocurrency-collectibles-5174217 ).  Sorry for being a dumbass ya'll.  cheers-ty
Have you tried the "Single Topic" version?

"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?).

Just go to the topic you want to update (read the disclaimer above), copy the entire thing, open your console's developer tools console (on Chrome/Edge: Ctrl + Shift + I), paste it, run it.

Let me know of any errors you get.

Hell...please bare with me and if you want to ignore me, wouldn't blame ya!  I read all rules, and followed directions from your last post.  I realized I just had to comply with the chrome rules of "make sure you know what script you're running".  I then highlighted the entire box of code from your github link, and c/p/enter into console ..it ran and said it was fixing all the images , and each one now says uploaded with a talkimg link. At the end of everything in console remains lines 227-30..stating "Finished".  I now realize maybe I wasn't supposed to copy everything from that script box?  I stupidly missed the copy script button to the right of "embed". So, not sure if that was a fck up or not...assuming not..but assuming makes an ...well you know.

If I ran it properly, and I did so about 30mns ago now..none of the broken links were fixed.  I didn't get any errors though in the console box.  I also realize I may have fd up by simply opening btalk in another tab to type this up but I THINK the script had finished by that time. I think.  Perhaps the images are too large too..I dunno. I would doubt they all would be, however ( https://bitcointalksearch.org/topic/historical-timeline-of-the-physical-bitcoin-cryptocurrency-collectibles-5174217 )

Apologies for being such a moron. I will def be donating a few sats regardless to that addy. I really appreciate all that you do here! .. as well as your fellow Mr Robots (like my buds LV and PG and of course the mods!)  


It worked, I'm good to go. Thanks !!
legendary
Activity: 2758
Merit: 6830
Any guidance would be much appreciated!  I have quite a few topics I worked hard on that need to img fixed and would sldo benefit those down the road to stay looking nice (here's what I tried to work on- https://bitcointalksearch.org/topic/historical-timeline-of-the-physical-bitcoin-cryptocurrency-collectibles-5174217 ).  Sorry for being a dumbass ya'll.  cheers-ty
Have you tried the "Single Topic" version?

"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?).

Just go to the topic you want to update (read the disclaimer above), copy the entire thing, open your console's developer tools console (on Chrome/Edge: Ctrl + Shift + I), paste it, run it.

Let me know of any errors you get.
legendary
Activity: 2282
Merit: 3014
I know some will be quite shocked, but I finally tried to run this, and uhh , coming up short...story of my life.

I read at least 6-7 articles on how to properly run a script, but not one explained how on a 1990's AOL Script Kiddie level of savy..thats more my speed.  Read through this thread best as I could (it's late, bout to east a snack and pass the f out).

I would post the exact errors but I dunno if by providing exposing anything I shouldn't.. but top error "Uncaught type error: Fail to execute"  then a second warning telling me I'm an idiot and not to post code I don't understand...They pegged me dead on there.

Any guidance would be much appreciated!  I have quite a few topics I worked hard on that need to img fixed and would sldo benefit those down the road to stay looking nice (here's what I tried to work on- https://bitcointalksearch.org/topic/historical-timeline-of-the-physical-bitcoin-cryptocurrency-collectibles-5174217 ).  Sorry for being a dumbass ya'll.  cheers-ty


Had more to write,.just fell asleep doing it..all for now..thanks my friends for any guidance! 
legendary
Activity: 2730
Merit: 7065
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!
legendary
Activity: 2758
Merit: 6830
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
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
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
legendary
Activity: 2730
Merit: 7065
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. 
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
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.
legendary
Activity: 2730
Merit: 7065
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. 
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
@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.
legendary
Activity: 2758
Merit: 6830
@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.
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
@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...
legendary
Activity: 3220
Merit: 1374
Slava Ukraini!
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.  Undecided
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.
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
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.  Undecided
If you experience this type of situation again, let us know.
legendary
Activity: 1722
Merit: 2213
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.
legendary
Activity: 3220
Merit: 1374
Slava Ukraini!
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%:

Will try to run script again tomorrow, though most of remaining images isn't relevant anymore
legendary
Activity: 1722
Merit: 2213
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.

legendary
Activity: 3766
Merit: 4554
Contact @yahoo62278 on telegram for marketing
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.
legendary
Activity: 1722
Merit: 4711
**In BTC since 2013**
Is that a 138meg .gif   Cheesy     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, and for the right images it still produces smaller files than .png. So let's keep .gif Smiley

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...  Roll Eyes
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.

Pages:
Jump to: