instagram-scraper icon indicating copy to clipboard operation
instagram-scraper copied to clipboard

Can't scrape date. Please try again or submit issue to the github

Open yugkha3 opened this issue 2 years ago • 0 comments

import scrapper from 'instatouch';

const options = {
    // Number of posts to scrape: {int default: 0}
    count: 10,

    // Download posts or not. {boolean default: false}
    download: false,
    
    // Archive downloaded posts. {boolean default: false}
    // If set to {false} then posts will be saved in the newly created folder
    zip: false,

    // How many post should be downloaded asynchronously. Only if {download:true}: {int default: 5}
    asyncDownload: 5,

    // Media type to scrape: ["image", "video", "all"]: {string default: 'all'}
    mediaType: 'image',

    // Set proxy {string[] | string default: ''}
    // http proxy: 127.0.0.1:8080
    // socks proxy: socks5://127.0.0.1:8080
    // You can pass proxies as an array and scraper will randomly select a proxy from the array to execute the requests
    proxy: '',

    // File name that will be used to save data to: {string default: '[id]'}
    filename: '[id]',

    // File path where all files will be saved: {string default: 'USER_HOME_DIR'}
    filepath: `USER_HOME_DIR`,

    // Output with information can be saved to a CSV or JSON files: {string default: 'na'}
    // 'csv' to save in csv
    // 'json' to save in json
    // 'all' to save in json and csv
    // 'na' to skip this step
    filetype: `json`,
    
    // Set initial cursor value to start pagination over the feed from the specific point: {string default: ''}
    endCursor: '',

    // Timeout between requests. If error 'rate limit' received then this option can be useful: {int default: 0}
    timeout: 0,
    
    // Some endpoints do require a valid session cookie value
    // This value can be taken from the instagram web(you need to be authorized in the web version)
    // Open inspector(google chrome -> right click on the web page -> inspector->Network)
    // refresh page and in the "Network" section you will see the request, select it
    // scroll down to the "Request Headers" section and look for "cookie:" section
    // and there you will find this value "sessionid=BLAHLBAH"
    session: "sessionid=BLAHLBAH"
};

async function getPost(username) {
    const pictures = await scrapper.user(username, options);
    return pictures;
}

let data = await getPost("wtfpratyush");
console.log(data);

I am using the above code but the following error appears:

throw new Error(`Can't scrape date. Please try again or submit issue to the github`);                          ^

Error: Can't scrape date. Please try again or submit issue to the github
    at InstaTouch.extractData (f:\Projects\discord-bot\node_modules\instatouch\build\core\InstaTouch.js:373:27)
    at async InstaTouch.startScraper (f:\Projects\discord-bot\node_modules\instatouch\build\core\InstaTouch.js:150:13)
    at async promiseScraper (f:\Projects\discord-bot\node_modules\instatouch\build\entry.js:112:20)
    at async getPost (file:///f:/Projects/discord-bot/src/temp.js:55:22)
    at async file:///f:/Projects/discord-bot/src/temp.js:59:12

yugkha3 avatar Dec 09 '21 22:12 yugkha3