Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
Javascript for load more data on Reddit needed

I am trying to scrape some reddits using a software. Here is an example of subreddit that I am scraping: https://www.reddit.com/r/NFTExchange/

The software just scrapes the first page. For other pages, it is asking for Javascript code to either "load next page" or "load more data". I have tried searching codes on stackoverflow but no code is helping.

Here is what I tried but on loading next page, it scrapes first page again

var lastId;

function load(params) {
    params = params || {};
    $.getJSON("http://www.reddit.com/r/pics/.json?jsonp=?", params, function (data) {
        var children = data.data.children;
        $.each(children, function (i, item) {
            $("<img/>").attr("src", item.data.url).appendTo("#images");
        });
        if (children && children.length > 0) {
            lastId = children[children.length - 1].data.id;
        } else {
            lastId = undefined;
        }
    });
}

load();

$('.after').click(function () {
    if (lastId) {
        load({
            after: 't3_' + lastId
        });
    }
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!