3.0.2 • Published 3 months ago

opgg-scraper v3.0.2

Weekly downloads
27
License
ISC
Repository
github
Last release
3 months ago

API Reference

getStats(user, region, refresh)

Usage

import getStats from 'opgg-scraper';

async function test() {
  try {
    // Get stats and return only the results object
    const results = await getStats('trick2g#na1', 'na', true);
    return results;
  } catch (error) {
    return { error: error.message };
  }
}

// Run and display only the results object
test().then(results => console.log(results));       

##output

{
  name: 'Trick2g',
  level: '615',
  rank: 'Emerald 2',
  wins: '1',
  loses: '5',
  winrate: '17%',
  lp: '45 LP',
  mainChampion: 'Udyr',
  kda: '1.2 KDA',
  lastTime: '20 days ago',
  image: 'https://static.bigbrain.gg/assets/lol/riot_static/15.4.1/img/profileicon/6075.png'
}

Fetches player statistics from U.GG.

ParameterTypeDescriptionDefault
userstringSummoner name with optional tag (e.g., 'PlayerName' or 'PlayerName#123')-
regionstringServer region (e.g., 'na', 'euw', 'kr')-
refreshbooleanWhether to refresh the stats before scrapingfalse

Returns a Promise that resolves to an object containing player statistics.

Supported Regions

  • na1 - North America
  • euw1 - Europe West
  • eune1 - Europe Nordic & East
  • kr - Korea
  • br1 - Brazil
  • jp1 - Japan
  • las1 - Latin America South
  • lan1 - Latin America North
  • oce1 - Oceania
  • tr1 - Turkey
  • ru1 - Russia

Troubleshooting

Browser Detection Issues

If the scraper fails to find a browser automatically, you can modify the getBrowserExecutablePath() function in index.js to point to your Chrome/Chromium executable location.

Selector Changes

U.GG may change their website structure periodically. If the scraper stops working, it might be due to CSS selector changes. Check the console errors and update the selectors in the scrapeUGG() function.

Changelog

2.0.0 (2023-07-14)

Breaking Changes

  • Switched from OP.GG to U.GG for data source
  • Changed output format structure

New Features

  • Added support for player tags (e.g., PlayerName#123)
  • Added profile image URL to output

Dependencies

License

This project is licensed under the MIT License - see the LICENSE file for details.

Buy Me a Coffee

3.0.2

3 months ago

3.0.1

4 months ago

3.0.0

4 months ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago