imgur

raise ImgurClientError('JSON decoding of response failed.') imgurpython.helpers.error.ImgurClientError: JSON decoding of response failed

半世苍凉 提交于 2019-12-12 06:30:58
问题 For the code below: 12 imgur_client = ImgurClient(client_id, client_secret, access_token, refresh_token) 13 for p in range(100, 500): 14 search = imgur_client.gallery_search('cat', window='all', sort='time', page=p) 15 for i in range(0, len(search)): 16 #print(search[i].link) 17 #print(dir(search[i])) 18 print(search[i].type) 19 if search[i].comment_count > 30 and search[i].type!='gif': 20 count = 0 21 image_file = urllib2.urlopen(search[i].link, timeout = 5) 22 image_file_name = 'images/'+

How to do cURL php using AJAX to make a live request?

放肆的年华 提交于 2019-12-12 05:15:34
问题 I am currently using this code: <form enctype="multipart/form-data" method="post" action="upload_img.php"> Choose your file here: <input name="uploaded_file" type="file"/> <input type="submit" value="Upload It"/> </form> <? if( isset($_FILES['uploaded_file']) ) { $IMGUR_API_KEY = 'APIKEY'; $filename = $_FILES['uploaded_file']['tmp_name']; $handle = fopen($filename, "r"); $data = fread($handle, filesize($filename)); //$data is file data $pvars = array('image' => base64_encode($data), 'key' =>

Easiest way to get imgur content type from imgur API

爷,独闯天下 提交于 2019-12-12 04:03:57
问题 Link examples: https://imgur.com/oUO812R (1. image link) https://imgur.com/OBEF9yi (2. image link) https://imgur.com/WRFBK (album link) Currently I'm just doing https://api.imgur.com/3/gallery/[ID].json for all links and get wether is_album is true or not. This works for the 1. image link and the album link above, but it returns 404 for the 2. image link (no idea why). If it's returns 404, i'm doing an image api request ( https://api.imgur.com/3/image/OBEF9yi.json ) for that failed image. I

Get http://imgur.com/gallery/hot/page/1.json with jQuery

孤街醉人 提交于 2019-12-11 20:12:44
问题 Hello i try get this json with $.getJSON, also $.ajax(...) but nothing... jQuery.ajax({ url: "http://imgur.com/gallery/hot/page/1.json", type: 'GET', crossDomain:true, success: succ }); always i have errors like XMLHttpRequest cannot load http://imgur.com/gallery/hot/page/1.json. Origin my_ip is not allowed by Access-Control-Allow-Origin. also i tried get jsonp request but also nothing.. jQuery.ajax({ url: "http://imgur.com/gallery/hot/page/1.json", type: 'GET', dataType: 'jsonp', crossDomain

HTML Upload Form will only upload files found in the directory of the PHP file

梦想的初衷 提交于 2019-12-11 14:02:44
问题 I have an image uploader that uses the imgur.com API and jQuery's .ajax() function to upload images to their servers. However, if I browse for an image using the <input type="file"/> element of the form, it will only be successful in uploading an image if the image file is found in the same directory as the page.php file that the form is found in (shown below). How can I allow the form to upload images from any directory on my computer? page.php: <form action="page.php" method="post"> <input

Get the ID of an imgur image

99封情书 提交于 2019-12-11 09:35:59
问题 Here are some examples of imgur links: https://imgur.com/gallery/s2Bqq https://i.imgur.com/26xcQUF.jpg http://i.imgur.com/rfw7jrU.gif http://i.imgur.com/rfw7jrU.gifv The imgur API specifically asks for the ID of the image ( s2Bqq , 26xcQUF , etc), but offers no way, from what I've seen, to get the ID of an image given a link. So my question is, how would I, using PHP, get the ID of any imgur link? 回答1: Take the last component of the path and remove any extension on it. One approach: $id =

Imgur images not showing up in JSFiddle

ⅰ亾dé卋堺 提交于 2019-12-10 17:00:30
问题 I was about to ask a question about a JSFiddle, and I noticed that the images (which I've got on Imgur) don't show up. If I load the image directly in the browser, and then reload the fiddle the picture shows up, but if you haven't already loaded the pictures they won't display. Is there a way I can fix this? Or do I just need to host the pictures on a different site? Here's the link to the fiddle: http://jsfiddle.net/r4crr/3/ And here's a bit of dumb code from the fiddle that it appears is

uploading to Imgur v3 using Java https errors

眉间皱痕 提交于 2019-12-10 04:38:43
问题 I'm currently trying to upload to imgur using their current API v3, however I keep getting the error error: javax.net.ssl.SSLException: hostname in certificate didn't match: api.imgur.com != imgur.com OR imgur.com The error is pretty self-explaintory so I thought I would try using http instead but I get the error code 400 with imgur. I am not sure if this means how I am trying to upload is wrong or if Imgur doesn't like not SSL connections. Below is my module of code connecting to Imgur:

Uploading a png to imgur using javascript

荒凉一梦 提交于 2019-12-09 06:05:43
问题 I'm trying to use Javascript to upload a png to imgur. I've used the code directly from the Imgur API example, but I don't think I am passing the png file properly as I get an error message saying file.type is undefined . I think the file is ok as I've tried this with a few different pngs. My code is as follows: <html> <head> <script type="text/javascript"> function upload(file) { // file is from a <input> tag or from Drag'n Drop // Is the file an image? if (!file || !file.type.match(/image.*

Android, uploading a photo to host on imgur programatically

十年热恋 提交于 2019-12-09 03:16:30
问题 I have tried different methods to upload and retrieve a link via imgur but none have been successfull despite looking at the imgur api. http://api.imgur.com/examples#uploading_java But the following methods partly works.. im trying to retrieve, errors: if any errors occured. link to image: the link to the image hosted delete link: the link to delete the image hosted But i only end up with the "delete link", as the others are blank, check it out: public void post(String path) { List