Plugins allow you to modify instamancer's functionality and behavior while gathering data.
The following internal plugins are included with instamancer (but not enabled by default):
Plugin | Description |
---|---|
LargeFirst | Increase the first parameter in API requests to ask for more data |
Example:
instamancer hashtag puppies -c1000 --plugin LargeFirst --plugin MyPlugin
To install external plugins, you need to clone and install instamancer from source
Steps:
-
Clone the instamancer repository
-
Install instamancer's dependencies
-
Install the plugin with npm / yarn
-
Add the plugin to
plugins/plugins/index.ts
Example:
export { MyPlugin } from "myplugin";
-
Install instamancer
- You can skip this step if you want to run the CLI from source
-
Run the CLI with the plugin:
Example:
instamancer hashtag puppies -c100 --plugin MyPlugin
Add the plugin to the options
:
import * as instamancer from ".";
const options: instamancer.IOptions = {
plugins: [new instamancer.plugins.LargeFirst()],
silent: true,
total: 100,
};
const hashtag = instamancer.createApi("hashtag", "puppies", options);
(async () => {
for await (const post of hashtag.generator()) {
console.log(post);
}
})();