SuspiciousLookingOwl / scrape-yt

Simple lib to scrape information from youtube such as search results, video information, related videos, playlist information and up next video
https://www.npmjs.com/package/scrape-yt
MIT License
9 stars 3 forks source link

duration returns null on videos over 1 hour long #7

Closed SteeledSlagle13 closed 4 years ago

SteeledSlagle13 commented 4 years ago

Doing a video search with the name on a video that is over 1 hour puts null in the duration of the video.

Code:

const scrapeYt = require("scrape-yt").scrapeYt;

scrapeYt.search("1 hour Trance Mix With Mister Anderson - Transmission 006 [HD]").then(videos => {
  console.log(videos[0]);
});

Console output:

{
  id: 'L_LUpnjgPso',
  title: 'Fireplace 10 hours full HD',
  duration: null,
  thumbnail: 'https://i.ytimg.com/vi/L_LUpnjgPso/hqdefault.jpg?sqp=-oaymwEjCPYBEIoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLAgH7jbYsBHthSpHJIQlHT5fOCnkA',
  channel: {
    id: 'UCR5hpffFzzlEJoAqY2xotcg',
    name: 'Fireplace 10 hours',
    url: 'https://www.youtube.com/channel/UCR5hpffFzzlEJoAqY2xotcg'
  },
  uploadDate: '3 years ago',
  viewCount: 21224450
}
SteeledSlagle13 commented 4 years ago

possibly due to Videos Google API image

SuspiciousLookingOwl commented 4 years ago

Not able to reproduce image Can you reproduce it consistently?

Video Google API shouldn't matter since I'm scraping from the web.

SteeledSlagle13 commented 4 years ago

Hey yeah I’m able to reproduce. It’s a consistent issue. I tried in on runkit same issue

27354F25-E8C9-496B-9451-1D7465D56760

SuspiciousLookingOwl commented 4 years ago

Hmm that's weird, how's your Youtube timestamp format? is it like this? image

SteeledSlagle13 commented 4 years ago

091A71B0-BAC2-4302-963A-0DBAD0C7D156 A50AD108-C5B5-4A15-83C7-9D6B2EDB97C2

Looks the same. I’m also on mobile rn. But the issue is the same on my desktop. I ran npm install 2-3 days ago. And the npm runkit does the samething my desktop does

SuspiciousLookingOwl commented 4 years ago

Seems like regional issue, i connected to USA VPN and tried again, and it gives me null on the duration. Fixing this.

SteeledSlagle13 commented 4 years ago

Dang:/ thats interesting

SuspiciousLookingOwl commented 4 years ago

Ahh, i feel so stupid I have a function to convert h:m:s format to h.m.s format, but because i did the regex wrong, it only change the first : so it become h.m:s.

Should be fixed now, upgrade to version 1.2.1

SteeledSlagle13 commented 4 years ago

Awesome will upgrade!