Giter Site home page Giter Site logo

js-google-image-scraper's Introduction

Hi there ๐Ÿ‘‹

CantisW's Github Stats

Most Used Languages

Who I Am

I am a beginner currently focusing on learning more TypeScript and React.

js-google-image-scraper's People

Contributors

cantisw avatar commonkestrel avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

commonkestrel

js-google-image-scraper's Issues

Sponsored section breaks the scraper sometimes

Excellent scraper, just wanted to give a heads up on certain search queries that bring up product carousels on the top of the page offsetting everything.

image

I'm sure there's a better fix, but meanwhile I've temporarily fixed this by checking if the array is empty and iterating through img[56][1][0][1][1][0] instead of img[56][1][0][0][1][0]

    async function iterateThruImageArrays(imgObjects)
    {
    for (let i = 0; i < limit; i++) {
        if (imgObjects[i] && imgObjects[i][0][0]["444383007"][1]) {
            let url = imgObjects[i][0][0]["444383007"][1][3][0]; // the url
            urlsArray.push(url);
        }
    }
    }

    var imgObjectsRaw = img[56][1][0][0][1][0];

    await iterateThruImageArrays(imgObjectsRaw);
    
    if(urlsArray.length==0)
    {
        console.log("URL array was empty");
        imgObjectsRaw = img[56][1][0][1][1][0];
        await iterateThruImageArrays(imgObjectsRaw);
    }

    return { urls: urlsArray };

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.