Hey guys, I've never worked with API's/requests and all that stuff.
I'm trying to make a command in my discord bot that would grab a random image from imgur gallery.
Though I do not understand how this works at all even after reading the documentation.
ap i. imgur . com /endpoints/gallery#gallery-random
Right now I tried to do
Code [Command("aww")]
public async Task getRandomAww()
{
using (WebClient puppyClient = new WebClient())
{
string puppyLink = puppyClient.DownloadString("htt ps : // ap i. imgu r .c om/3/gallery/random/random/aww");
//pull image from imgur or the link?
}
}
But that doesn't work because it just returns
Code {"data":{"error":"Authentication required","request":"\/3\/gallery\/random\/random\/aww","method":"GET"},"success":false,"status":401}
this is a error-message
Code "error":"Authentication required"
you need a imgur api key. register at developer on imgur and get your apikey
DO NOT DEAL WITH THIS MEMBER
Jun 26, 2018 06:26 PM
(This post was last modified: Jun 26, 2018 06:30 PM by Tunabish.)
I figured out how to get a set of images from imgur gallery, but I haven't figured out how I get like the link of these images....
I know there's a .Link function but ehh D:
I'm using an imgur wrapper, which I would link if I could post links.
edit : http :// imgurapi.readthedocs . io/en/latest/endpoints/gallery-endpoint/#getsubredditgalleryasync
Code public async Task GetImage()
{
try
{
var client = new ImgurClient("APP-ID");
var endpoint = new GalleryEndpoint(client);
var images = await endpoint.GetSubredditGalleryAsync("aww");
Console.WriteLine();// here I wanted to print the link
}
catch (ImgurException imgurEx)
{
Debug.Write("An error occurred getting an image from Imgur.");
Debug.Write(imgurEx.Message);
}
}
It doesn't work if I just do images[1].Link
Anyone knows how I do this? x_x
What's the return type of GetSubredditGalleryAsync() I can't find it on their docs.
DO NOT DEAL WITH THIS MEMBER
(Jun 25, 2018 12:29 PM).kr. Wrote: this is a error-message
Code "error":"Authentication required"
you need a imgur api key. register at developer on imgur and get your apikey
You don't need an API key, just go to the home page ( or category page ) and download every image by <img>/<image> tag, then scroll down
this is a webbrowser method i used to scrape 2.77M Images
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 05:50 AM)Infirmary Wrote: You don't need an API key, just go to the home page ( or category page ) and download every image by <img>/<image> tag, then scroll down
this is a webbrowser method i used to scrape 2.77M Images
this is a retarded way, do not use the way this retard said to do it.
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 06:26 AM)int Wrote: this is a retarded way, do not use the way this retard said to do it.
Why??
WebBrowser could suck but as long as you use proxies for scraping tons of images, Could Violate TOS..
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 06:29 AM)Infirmary Wrote: Why??
WebBrowser could suck but as long as you use proxies for scraping tons of images, Could Violate TOS..
webbrowser is for retards and scraping images, downloading, and sending to discord is for retards.
DO NOT DEAL WITH THIS MEMBER
Who would wanna use Imgur's API, it sucks..
Use a Webbrowser without the window ( not giving code ) and ignore this guy..
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 06:34 AM)Infirmary Wrote: Who would wanna use Imgur's API, it sucks..
Use a Webbrowser without the window ( not giving code ) and ignore this guy..
so ur telling me instead of sending a link to an image on discord,
you want to download the image, upload to discord, and send the uploaded link?
iq 10
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 07:18 AM)int Wrote: so ur telling me instead of sending a link to an image on discord,
you want to download the image, upload to discord, and send the uploaded link?
iq 10
Did I say a link.. Do i have to explain everything ??
Plus, You can Download then upload image & delete a Downloaded image
iq 10 means idiots like you need to ask self-explanatory questions..
P.S. It's pretty obvious.. IF you arent "iq 10" that someone shouldn't have to explain everything to you at once
DO NOT DEAL WITH THIS MEMBER
yeah ok retard, let me know when u get a brain to use an api
DO NOT DEAL WITH THIS MEMBER
(Jun 27, 2018 07:28 AM)int Wrote: yeah ok retard, let me know when u get a brain to use an api
Whatever. API's cost performance & Money 🤭 😎
Jun 27, 2018 05:10 PM
(This post was last modified: Jun 27, 2018 05:15 PM by gigajew.)
Here's a sample project. You need to implement your own way to see if a picture redirects to removed.png though https://files.catbox.moe/rtryeq.zip
|