atomjack / dubtrackapi

An API for creating bots on Dubtrack.fm
22 stars 5 forks source link

Bot is broken after weekend video update #14

Open ImGrumpy opened 8 years ago

ImGrumpy commented 8 years ago

This weekend, Dubtrack added code to compensate for Chrome's new feature of not playing videos on background tabs.

Now the bot receives this error on connect. Sometimes he'll load, but if he does in those cases he crashes at the first song advance.

Bot continues to run, but will no longer function.

TypeError: undefined is not a constructor (evaluating 'this.player.loadVideoById')
[{"file":"https://mediadubtrackfm.s3.amazonaws.com/assets/js/dubtrack
.min.js?v=13232234326609712","line":7,"function":"loadVideo"},{"file":"https://m
ediadubtrackfm.s3.amazonaws.com/assets/js/dubtrack.min.js?v=13232234326609712","
line":7,"function":"buildYT"},{"file":"https://mediadubtrackfm.s3.amazonaws.com/
assets/js/dubtrack.min.js?v=13232234326609712","line":7,"function":"render"},{"f
ile":"https://mediadubtrackfm.s3.amazonaws.com/assets/js/dubtrack.min.js?v=13232
234326609712","line":7,"function":"realTimeUpdate"},{"file":"https://mediadubtra
ckfm.s3.amazonaws.com/assets/js/includes.min.js?v=13232234326609712","line":13,"
function":"l"},{"file":"https://mediadubtrackfm.s3.amazonaws.com/assets/js/inclu
des.min.js?v=13232234326609712","line":13,"function":"trigger"},{"file":"https:/
/mediadubtrackfm.s3.amazonaws.com/assets/js/dubtrack.min.js?v=13232234326609712"
,"line":2,"function":"callback"},{"file":"https://mediadubtrackfm.s3.amazonaws.c
om/assets/js/dubtrack.min.js?v=13232234326609712","line":2,"function":"callback"
},{"file":"https://cdn.pubnub.com/pubnub.min.js","line":81,"function":""},{"file
":"https://cdn.pubnub.com/pubnub.min.js","line":35,"function":"N"},{"file":"http
s://cdn.pubnub.com/pubnub.min.js","line":81,"function":"c"},{"file":"https://cdn
.pubnub.com/pubnub.min.js","line":59,"function":"f"}]
jcott28 commented 8 years ago

I'm having a problem as well. Not sure if it's related to this or not. I tried pulling down the code fresh to start over with a skeleton, but no good. It doesn't appear to login anymore. I've tried both with creds and the sid. Perhaps it's related to the changes on the site.

jcott28 commented 8 years ago

Perhaps it's my OS. But yeah, I've tried all sorts of things. If I use credentials, it never logs in correctly. If I use SID, then it thinks it's logged in, but on the room page, it's not really logged in, so it can't parse the div's it's looking for.

Does anyone have a working bot and corresponding api file I can try on my machine? I'm using OSX. Node 4.1.2 and phantomjs 2.0.0.

atomjack commented 8 years ago

@jcott28 Here's one thing to try:

bot.on('ready', function(data) {
bot.page.render("/path/to/image.png");
console.log("rendered");
});

That will have the virtual browser render a screenshot of what it's seeing - you can use that to diagnose whether or not you are logged in. I'm not sure why it's not working when you use username and password as it is working for me, but with the connect.sid cookie it's possible the cookie is no longer valid? I had that problem recently and had to login via a regular browser and get a new value for the cookie.

jcott28 commented 8 years ago

Tried that. I actually think it might have to do with being on OSX Yosemite. I had to build phantomjs2 myself, as there are issues with it on OSX. But I did get that going. But there is something funky, I think, with OSX and this combo of products.

The interesting thing being that I did have it capturing events a couple weeks ago.

I'll keep digging in and see if I can figure it out. Not sure if anyone else is using Yosemite or not.

atomjack commented 8 years ago

So when you got a screenshot, the bot wasn't logged in?

jcott28 commented 8 years ago

It's the same as the screenshots from here: https://github.com/atomjack/dubtrackapi/issues/15

atomjack commented 8 years ago

Ugh yeah it looks like the page is not even fully loading, no matter how long you wait. I downloaded a phantomjs binary (from https://github.com/eugene1g/phantomjs/releases) but I am getting the same thing. Trying to see if there are any phantom errors I can track down.

atomjack commented 8 years ago

Not having any luck either. It looks like phantomjs on OS X just doesn't play nice with the way dubtrack is doing its thing (changing the page around with javascript). I also tried it using straight phantomjs (without node), and got the same thing - it just won't completely load the page.

jcott28 commented 8 years ago

I'm seeing what I can do with CasperJS just to see if it works. Ive been able to get the pages to load at least. But it's basically a total rewrite going that route. Hopefully the Phantom guys release a new build for OSX.

technobly commented 8 years ago

I enabled debugging of events and tracked it down to more stuff happening on Windows after the initial page load event fires that doesn't happen on OSX. Sounds like the javascript that's loading the login modal resources is not running, but very hard to see any of these errors via PhantomJS. I considered presenting that A vs. B comparison in issue #15 of just loading dubtrack.fm/login with PhantomJS to them as a github issue, but ran out of time over the weekend.

EDIT: Submitted an issue to the PhantomJS repo: https://github.com/ariya/phantomjs/issues/13696

technobly commented 8 years ago

I'm getting the same error as the first post by ImGrumpy, when running the bot in windows.

tonkku107 commented 8 years ago

Any updates? I'd like to get this working