philbot9 / youtube-info

Fetch meta information about YouTube videos
ISC License
43 stars 20 forks source link

Always giving me StatusCodeError: 403 - "" #37

Open ryuujo opened 4 years ago

ryuujo commented 4 years ago

Sometimes I need to re-fetch it again and again and takes more than 10 times re-fetching until I can get the data properly. And it's totally annoying since I use this data to get video title image

FBIMiro commented 4 years ago

Experiencing the same thing

APKiwi commented 4 years ago

Also experiencing the same thing

ryuujo commented 4 years ago

Is it possible that the code now deprecated? I see no updates since last 2 years

skzap commented 4 years ago

Same

skzap commented 4 years ago

Changing the user-agent to 'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)' in lib/fetch-page.js fixed the issue for me. Somehow wish we could pass the User-Agent option directly from the fetchVideo(id, opts)

jbernar3 commented 4 years ago

Changing the user-agent to that worked for me as well. I found it in index.js.

udhayakumaran commented 4 years ago

Changing the user-agent works for me as well

TheMonDon commented 4 years ago

Changing the user agent worked for a day for me but now it stopped working

lollka commented 4 years ago

I used this hotfix, still works for me, using default user-agent:

/* return fetchCommentCount(videoId, sessionToken, commentToken).then(function (
      commentCount
    ) {
      videoInfo.commentCount = commentCount */
      return videoInfo
    //})

I commented/removed lines 28-31 and 32, leaving only "return videoInfo" in index.js, because it looks like fetching comment count via "https://www.youtube.com/watch_fragments_ajax" doesn't work anymore. And this caused to return error 403 for me.

Edit: If you need video author, change:

var owner = $('.yt-user-info > a').text()

To this:

var owner = body.split('\"author\":\"')[1].split('","')[0]

In line 115.

Jaysojitra13 commented 4 years ago

I faced the same issue of status code 4: Problem: In index.js file, When it tries to run fetchCommentCount(which calculate the comment count), causes an error of 403.

kylerchin commented 3 years ago
dQw4w9WgXcQ
Unhandled rejection Error: StatusCodeError: 403 - ""
    at /home/disrupt/discordbots/Adora-Bot/node_modules/youtube-info/index.js:101:15
    at tryCatcher (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/disrupt/discordbots/Adora-Bot/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:461:21)

Still broken for me