npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

social-scanner

v0.1.5

Published

A node utility to scan various social networks against username.

Downloads

5

Readme

banner

Installation

You can install it via npm or yarn.

npm install social-scanner
yarn add social-scanner

Looking for the cli?

You can use it from the command line installing the globally the cli repository.

npm install -g social-scanner-cli
yarn global add social-scanner-cli

How it works?

The script can be used as a module and take specific options in order:

socialScanner(username, options, callback)

By default it will perform an HTTP request for each rule existing in the project against the given username, if the page exists (return 200 status code) and depending by rule, if different response content assertions succeeds is treated as positive.

const socialScanner = require('../lib/index');

socialScanner('codekraft-studio', {}, (err, response) => {
  if (err) {
    console.log('Error:', JSON.stringify(err, null, 2));
    return;
  }
  console.log('Response:', JSON.stringify(response, null, 2));
});

You can also capture the output in different formats. By default is BASE64, but you can use PNG or many more using the captureOptions object to pass options directly to webpage-capture which is the one you is in charge of web screenshots.

// outputType: 'base64|png|pdf'
socialScanner('codekraft-studio', {
  capture: true,
  captureOptions: {
    outputType: 'base64',
    onlySuccess: true,
    outputType: 'file'
  }
}, (err, response) => {
  // some code
});

To specify a custom path for the files you must pass it to outputDir option like so:

socialScanner('codekraft-studio', {
  capture: true,
  outputDir: '/home/user/Desktop'
});

Options

This is the options object to customize the HTTP request behavior, is passed directly to request

  • requestOptions: A object of options passed to request

The default values used by the script are:

strictSSL: false,
followRedirect: true,
followAllRedirects: false,
maxRedirects: 2,
timeout: 3000

Filters

These are the options object properties dedicated to filter the rules to test against the given input.

  • restrict: A list (or array) of social networks to scan
  • restrictCategories: An array of restrict rule categories

By default no restrictions will be made and all the rules will be tested.

Output

  • onlySuccess: Returns only results that matched the search
  • capture: Take screenshot of the resulting page(s)
  • outputDir: The output directory where place the screenshots
  • captureOptions: A object of options passed directly to webpage-capture
    • crop: If the screnshot should be cropped or not
    • onlySuccess: Returns only results that matched the search
    • outputType: Change the output format for the capture result
onlySuccess: false,
capture: false,
captureOptions: {
  outputType: 'base64',
  onlySuccess: false,
  crop: true
}

This are the default properties used by the script are listed below, for the full options list refer to webpage-capture github page. Please note this, if the option on the child package has the same name in this package please don't use the option in the child because it's needed in this package to customize the operations.


Examples

The code is very simple to use, the best way is just try it with your username to see in which services is already taken and where is you or not, if you find some response incongruences, for example the response say it's a match but obviously is not, please be kind and open a new issue following this format.

Scan a username against all rules

Scan a username against various social networks, without taking screenshots.

socialScanner(username, {}, (err, response) => { });
Scan a username against all rules taking screenshots to string (base64)

Scan a username against various social networks, taking screenshots.

socialScanner(username, {
  capture: true,
  onlySuccess: true
}, (err, response) => { });
Scan a username against all rules taking screenshots to file (png)

Scan a username against various social networks, taking screenshots to file in the default PNG format, the files will be placed in a output subfolder called as the username for example, with my username, the output will be stored in: ./output/b4dnewz.

socialScanner(username, {
  onlySuccess: true,
  capture: true,
  captureOptions: {
    outputType: 'file'
  }
}, (err, response) => { });
Filter the list of rules to scan by rule name

Scan username against some restricted social networks, the rules are filtered by rule name, you can see the full list in the rules page.

socialScanner(username, {
  restrict: ['facebook', 'github']
}, (err, response) => { });
Filter the list of rules to scan by rule category

Scan username against some restricted social categories, the rules are filtered by their category, if you use the cli tool there is a command to list all the categories, otherwise look at the rules page or try to guess them, they are english words so pretty prevedible, for example: tech, design, ....

socialScanner(username, {
  restrictCategories: ['community']
}, (err, response) => { });

Adding rules

So you want to add a rule or a set of rules to the tool? Maybe you have tried it with your username and you haven't find listed your favorite social network or web service. There is a solution for this, simply open a new issue asking what service you want to add and it will be integrated as soon as possible in the next releases.

What I need to know?

For example you want to integrate you favourite social network which is called example.com and you know the profile pages for that website are under the path: example.com/profile/<my-username>, you also know this website doesn't allow some kind of characters for usernames, because during the registration process you have tried many different wrong usernames.

How to integrate?

Now you can open a new issue following the template and describing as much as you can the website you want to add or you can fork the repository and add the rule yourself, take a look at the rules file than add your new rule object and submit a pull request.


License

The social-scanner is released under the MIT License by b4dnewz.

Contributing

  1. Fork it ( https://github.com/b4dnewz/social-scanner/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Write and run the tests (npm run test)
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request