axios user agent code example

Example 1: axios node js set user agent

axios
    .get(`https://www.ebay.com/itm/Apple-iPhone-11-64GB-All-Colors-GSM-CDMA-Unlocked-Apple-Factory-Warranty-/163856625084`, 
{ headers: { 'User-Agent': 'YOUR-SERVICE-NAME' }  } )
    .then(response => {
      
      // here will be cheerio scraping
    })
    .catch(function(e) {
      console.log(e);
    });

Example 2: scrapy user agent

#add this lines into settings.py
DOWNLOADER_MIDDLEWARES = {
    'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': None,
    'scrapy_user_agents.middlewares.RandomUserAgentMiddleware': 400,
}