reddit image grabber

No algorithm description given

Grab images from a subreddit's front page. The following JSON input parameters are mandatory: subreddit: The name of the subreddit. category: Can be 'hot', 'new', 'rising', 'controversial', or 'top'. The following JSON input parameters are optional: limit: The maximum number of items desired (default: 25, maximum: 100). after: Fetch entries that are listed after the one with the name assigned to this property. before: Fetch entries that are listed before the one with the name assigned to this property. count: The number of items already seen. A positive integer (default: 0). user_agent: Many default User-Agents are drastically limited to encourage unique and descriptive user-agent strings. Use this parameter to define your own. domains: The list of image host domains you want to grab images from. Defaults to two possible imgur domains: ['', '']. For "pagination": "Many endpoints on reddit use the same protocol for controlling pagination and filtering. These endpoints are called Listings and share five common parameters:   after   / before ,   limit ,   count , and   show . Listings do not use page numbers because their content changes so frequently. Instead, they allow you to view slices of the underlying data. Listing JSON responses contain after   and   before   fields which are equivalent to the "next" and "prev" buttons on the site and in combination with   count   can be used to page through the listing. The common parameters are as follows: after   /   before   - only one should be specified. these indicate the   fullname   of an item in the listing to use as the anchor point of the slice. limit   - the maximum number of items to return in this slice of the listing. count   - the number of items already seen in this listing. on the html site, the builder uses this to determine when to give values for   before   and   after   in the response. To page through a listing, start by fetching the first page without specifying values for after   and   count . The response will contain an   after   value which you can pass in the next request. It is a good idea, but not required, to send an updated value for count   which should be the number of items already fetched." ( source ) This algorithm makes requests to the Reddit API, hence careful attention needs to be put into Reddit API restrictions. In particular with the frequency of requests: " Reddit provides an API, and unlike some websites, it’s actually quite easy to use. It’s based on REST and JSON, so in theory doesn’t require any fancy setup. The important thing is to follow the rules they set. Two of the most important ones are: You can’t make more than 1 request every 2 seconds (or 30 a minute) . You must not lie about your user agent. Read the rest here . The user agent is what identifies your browser. Libraries like Python’s urllib are severely restricted by Reddit to prevent abuse. Reddit recommends you use your own special user agent." ( source )

(no tags)

Cost Breakdown

0 cr
royalty per call
1 cr
usage per second
avg duration

Cost Calculator

API call duration (sec)
API calls
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

No permissions required

This algorithm does not require any special permissions.

To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY'
View cURL Docs
algo auth
algo run algo://legeorges/redditimagegrabber/0.3.1 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import (
  algorithmia ""

input := {{input | formatInput:"go"}}

var client = algorithmia.NewClient("YOUR_API_KEY", "")
algo, _ := client.Algo("algo://legeorges/redditimagegrabber/0.3.1")
resp, _ := algo.Pipe(input)
response := resp.(*algorithmia.AlgoResponse)
View Go Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://legeorges/redditimagegrabber/0.3.1");
AlgoResponse result = algo.pipeJson(input);
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://legeorges/redditimagegrabber/0.3.1")
val result = algo.pipeJson(input)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
           .then(function(output) {
View Javascript Docs
using Algorithmia;

var input = "{{input | formatInput:"cs"}}";
var client = new Client("YOUR_API_KEY");
var algorithm = client.algo("algo://legeorges/redditimagegrabber/0.3.1");
var response = algorithm.pipe<object>(input);
View .NET/C# Docs
var input = {{input | formatInput:"javascript"}};
           .then(function(response) {
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('legeorges/redditimagegrabber/0.3.1')
print algo.pipe(input)
View Python Docs

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("legeorges/redditimagegrabber/0.3.1")
result <- algo$pipe(input)$result
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('legeorges/redditimagegrabber/0.3.1')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::Algorithmia;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo("legeorges/redditimagegrabber/0.3.1");
let response = algo.pipe(input);
View Rust Docs
import Algorithmia

let input = "{{input | formatInput:"swift"}}";
let client = Algorithmia.client(simpleKey: "YOUR_API_KEY")
let algo = client.algo(algoUri: "legeorges/redditimagegrabber/0.3.1") { resp, error in
View Swift Docs
  • {{comment.username}}