Socket
Socket
Sign inDemoInstall

9gag-scraper

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    9gag-scraper

Scrape data/images from 9GAG website


Version published
Weekly downloads
3
Maintainers
1
Install size
4.68 MB
Created
Weekly downloads
 

Readme

Source

9gag-scraper

Build Status

Scrape data from 9GAG website

Installation

npm install 9gag-scraper --save

Usage

var gagScraper = require('9gag-scraper')

Scrape data from a 9GAG section

new gagScraper("trending").getGags(function (error, data) {

    console.log(data.count); // Total posts returned
    console.log(data.gags); // posts object ( array of posts )

    console.log(data.gags[0].id); // 9GAG post ID
    console.log(data.gags[0].url); // 9GAG post URL
    console.log(data.gags[0].title); // 9GAG post title
    console.log(data.gags[0].image); // 9GAG post image link

});

// You can also pass in any valid section you want to scrape from ( Defaults to 'hot' )
new gagScraper("fresh").getGags(function (error, data) {
});

new gagScraper("meme").getGags(function (error, data) {
});

NSFW section scraping won't work as it requires users to login to view the content.

To get a random post

new gagScraper().getRandom(function (error, data) {
    console.log(data.id); // 9GAG post ID
    console.log(data.url); // 9GAG post URL
    console.log(data.title); // 9GAG post title
    console.log(data.image); // 9GAG post image link
});

new gagScraper("random").getGags(function (error, data) {
});

Tests

npm test

Keywords

FAQs

Last updated on 06 Sep 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc