Socket
Socket
Sign inDemoInstall

yt-trending-scraper

Package Overview
Dependencies
4
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "yt-trending-scraper",
"version": "1.0.3",
"version": "1.0.4",
"description": "Identifies the currently trending videos on YouTube and returns all trending site information about every video without accessing the YouTube API.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,6 +16,7 @@ # YouTube Trending Videos NodeJS Documentation

## API
**scrape_trending_page()**
**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.
```javascript
ytrend.scrape_trending_page().then((data) =>{
ytrend.scrape_trending_page('JP').then((data) =>{
console.log(data);

@@ -22,0 +23,0 @@ }).catch((error)=>{

@@ -5,3 +5,3 @@ const axios = require("axios")

class TrendingRequester {
static async requestTrendingPage() {
static async requestTrendingPage(geoLocation = null) {
const config = {

@@ -15,3 +15,8 @@ headers: {

try {
return await axios.get(trending_page, config)
if (geoLocation !== null) {
return await axios.get(trending_page+`?gl=${geoLocation}`, config)
} else {
return await axios.get(trending_page, config)
}
} catch (e) {

@@ -18,0 +23,0 @@ return {

@@ -7,4 +7,4 @@ const requester = require("./TrendingRequester")

//starting point
static async scrape_trending_page() {
const request_data = await requester.requestTrendingPage();
static async scrape_trending_page(geoLocation= null) {
const request_data = await requester.requestTrendingPage(geoLocation);
return this.parse_html(request_data.data);

@@ -11,0 +11,0 @@ }

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