post-miner
v1.0.9
Published
SDK for automating login and scraping workflows for social platforms (Facebook, Instagram, LinkedIn, Twitter, etc...) using Puppeteer.
Downloads
14
Maintainers
Readme
👀 Quick Preview
Here’s Post-Miner working on social media sites:
🚀 Features
- ✅ Multi-Platform Support: Facebook, Instagram, LinkedIn, Twitter...
- 🔐 Automated Login: Credentials or persistent sessions
- 🍪 Cookie Management: Save/load across runs
- 🕵️♂️ Stealth Mode: Puppeteer-extra for anti-bot detection
- 📦 Unified API: Consistent interface across all platforms
- 📚 Multiple Sessions: Isolated sessions with per-platform cookie storage
💡 Use Cases
- Automatically extract product listings from social media and analyze
- Build smart bots that log in, collect data, and interact with users autonomously
- Monitor competitor pages and public profiles across social platforms
- Build custom search engines or classified ad trackers
📦 Installation
npm install post-miner🧑💻 Basic Usage
import { FacebookController } from 'post-miner';
const fb = new FacebookController('./cookies/facebook.json', {
email: '[email protected]',
password: 'your-password',
});
await fb.init();
const page = fb.getPage(); // Puppeteer Page instance
await page.goto('https://www.facebook.com');
await fb.close(); // Close the browser session🧩 Other Platforms
new FacebookController('./cookies/facebook.json', { email, password });
new InstagramController('./cookies/instagram.json', { email, password });
new LinkedinController('./cookies/linkedin.json', { email, password });
new TwitterController('./cookies/twitter.json', { email, password });API Methods:
.init(): initialize controller.getPage(): get Puppeteer page.getBrowser(): get browser instance.getContext(): get context instance.close(): clean shutdown
Parameters:
pathCookies: file path to store/load cookiescredentials:{ email, password }headless: boolean (default: false)defaultViewport:{ width, height }ornull
🛠️ Development
git clone https://github.com/mohamad-aljeiawi/post-miner.git
cd post-miner
npm install
npm run dev # Run test.ts in live dev modenpm run build
npm run lint # Lint code
npm run format # Format code🗂️ Project Structure
src/
├── core/ # Shared logic: browser, cookies, base controller
├── platforms/ # Platform-specific controllers
├── index.ts # Entry point🧱 Add a New Platform
To add support for another website/platform:
- Create a new controller in the
platforms/directory. - Extend from
BaseControllerand implement:needsLogin(): logic to detect login screenlogin(): steps to perform login
- Register the new controller in
index.ts - Add test case in
test.ts
Example template:
import { BaseController } from '../core/base-controller';
class PlatformController extends BaseController {
constructor(pathCookies, credentials, headless = false, defaultViewport = null) {
super(pathCookies, 'https://platform.com', headless, defaultViewport);
}
protected async needsLogin() {
// Logic to detect login page
}
protected async login() {
// Login steps
}
}Please run npm run format before submitting pull requests.
🙋♂️ Author
Built with 💻 by Mohamad Al Jeiawi
Telegram: @mohamad_aljeiawi
If you're building tools around scraping, automation, or AI and looking for a contributor or consultant — let’s talk.
⭐ Support & Feedback
If you find this useful, consider leaving a ⭐ on GitHub.
Pull requests, suggestions, and feedback are always welcome!
📄 License
MIT © Mohamad Al Jeiawi
