Socket
Socket
Sign inDemoInstall

yt-trending-scraper

Package Overview
Dependencies
2
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yt-trending-scraper

Identifies the currently trending videos on YouTube and returns all trending site information about every video without accessing the YouTube API.


Version published
Maintainers
1
Created

Readme

Source

This NodeJS library scrapes the trending page of YouTube without any API usage. It is developed for and tailored towards easy usage in the FreeTube rewrite but can be used with any other project as well.

Therefore, this library does not require any API keys, with the attached maximum quotas, but instead might take longer to receive the required data.

The library works as long as YouTube keeps its web page layout the same. Therefore, there is no guarantee that this library will work at all times. If this library should not work at some point, please create an issue and let me know so that I can take a look into it. Pull requests are also welcomed in this case.

Installation

npm install yt-trending-scraper

##Usage const ytrend = require("yt-trending-scraper")

API

scrape_trending_page(geoLocation) Returns a list of objects containing all the information of the trending videos. geoLocation is an optional parameter to change the country (e.g. JP for Japan) of the trending page.

ytrend.scrape_trending_page('JP').then((data) =>{
    console.log(data);
}).catch((error)=>{
    console.log(error);
});

// The data is a list of objects containing the following attributes:
{
    videoId:            String,
    title:              String,
    type:               "video",
    author:             String,
    authorId:           String,
    authorUrl:          String,
    videoThumbnails:    Array[Objects],
    description:        String,
    viewCount:          Number,
    published:          Number as timestamp,
    publishedText:      String,
    lengthSeconds:      Number,
    timeText:           String,
    liveNow:            false,
    paid:               false,
    premium:            false,
    isUpcoming:         false
}

// The thumbnail objects:
{
    quality:    "String",
    url:        "String",
    width:      Number,
    height:     Number
}

Credits

Thanks to PrestoN for the basic instructions and underlying request code and thanks to ~cadence for the HTML extractor RegEx.

Keywords

FAQs

Last updated on 15 Jan 2021

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