TSedlar / anitrack

A web extension that tracks what you're watching/reading with MyAnimeList or Kitsu
MIT License
30 stars 7 forks source link

Manga tracking isn't working (error in devtools console) #27

Closed thibaultmol closed 6 years ago

thibaultmol commented 6 years ago

Thanks for adding Manga support btw! Both me and a friend are having issues with it not working. When we open the extension in Chrome devtools and look at the console out put we get:

Handling http://kissmanga.com/manga/haikyuu/312---take-aim-002?id=432360#5
bundle.js:1 life: 247249
bundle.js:1 data:
bundle.js:1 {title: "Haikyuu!!", episode: 312, page: 5, pageCount: 18}
bundle.js:1 {id: "12619", type: "manga", links: {…}, attributes: {…}, relationships: {…}}
bundle.js:1 id: 12619
bundle.js:1 Uncaught TypeError: Cannot read property 'id' of undefined
    at R._callback (bundle.js:1)
    at R.n._callback.n.callback.n.callback (bundle.js:1)
    at R.n.emit (bundle.js:1)
    at R.<anonymous> (bundle.js:1)
    at R.n.emit (bundle.js:1)
    at n.IncomingMessage.<anonymous> (bundle.js:1)
    at n.IncomingMessage.n (bundle.js:1)
    at n.IncomingMessage.n.emit (bundle.js:1)
    at I (bundle.js:1)
    at bundle.js:1
(anonymous) @ bundle.js:1
n._callback.n.callback.n.callback @ bundle.js:1
n.emit @ bundle.js:1
(anonymous) @ bundle.js:1
n.emit @ bundle.js:1
(anonymous) @ bundle.js:1
n @ bundle.js:1
n.emit @ bundle.js:1
I @ bundle.js:1
(anonymous) @ bundle.js:1
m.run @ bundle.js:1
d @ bundle.js:1
setTimeout (async)
c @ bundle.js:1
a.nextTick @ bundle.js:1
nextTick @ bundle.js:1
f.resume @ bundle.js:1
f.addListener.f.on @ bundle.js:1
R.onRequestResponse @ bundle.js:1
n.emit @ bundle.js:1
n._connect @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
n._onFinish @ bundle.js:1
(anonymous) @ bundle.js:1
n.emit @ bundle.js:1
g @ bundle.js:1
(anonymous) @ bundle.js:1
u.end @ bundle.js:1
n.end @ bundle.js:1
R.end @ bundle.js:1
r @ bundle.js:1
(anonymous) @ bundle.js:1
m.run @ bundle.js:1
d @ bundle.js:1
setTimeout (async)
c @ bundle.js:1
a.nextTick @ bundle.js:1
R.init @ bundle.js:1
R @ bundle.js:1
a @ bundle.js:1
(anonymous) @ bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
mc @ bundle.js:1
Xn @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/312---take-aim-002?id=432360#5
bundle.js:1 life: 257179
bundle.js:1 data:
bundle.js:1 {title: "Haikyuu!!", episode: 312, page: 5, pageCount: 18}
bundle.js:1 {id: "12619", type: "manga", links: {…}, attributes: {…}, relationships: {…}}
bundle.js:1 id: 12619
bundle.js:1 Uncaught TypeError: Cannot read property 'id' of undefined
    at R._callback (bundle.js:1)
    at R.n._callback.n.callback.n.callback (bundle.js:1)
    at R.n.emit (bundle.js:1)
    at R.<anonymous> (bundle.js:1)
    at R.n.emit (bundle.js:1)
    at n.IncomingMessage.<anonymous> (bundle.js:1)
    at n.IncomingMessage.n (bundle.js:1)
    at n.IncomingMessage.n.emit (bundle.js:1)
    at I (bundle.js:1)
    at bundle.js:1

EDIT: Chrome Version 68.0.3440.75 (Official Build) (64-bit)

TSedlar commented 6 years ago

I'll look into this soon, but first: are you using MAL or Kitsu? If it's the former their API has been down for almost a month at this point and no 3rd party application works with MAL currently. If it's Kitsu, I'll definitely have to look into it, as it worked fine (and other implemented sources) for the few manga that I tested (Orange, Black Clover)

thibaultmol commented 6 years ago

Oh yeah, sorry. I'm using Kitsu

TSedlar commented 6 years ago

Hm.. It works on firefox for both adding and updating..

Adding:

Updating (after i manually decremented the chapter read from 312 to 311):

It seems odd to me that it's erroring while reading the result.id variable, since it's clearly being printed out in the debug information.. Along with the fact that nothing inside of of checkEpisode calls id.. Very odd.

So it must be a chrome specific bug. I'll look into this later on today.

TSedlar commented 6 years ago

I've found out the issue debugging with a friend that had the same issue.

I believe you are signing in with your email, which doesn't let your user id be found, for example: mine

You can get around this by setting your profile url to your sign-in name and using that to sign into anitrack instead of your email.

thibaultmol commented 6 years ago

This was indeed the problem on my end. But it seems like it's still not working on a 100%. After a while (after first time updating via the Kitsu it seems?) it stops actually registering the chapters. Only thing the console is showing then is

set end cycle for http://kissmanga.com/manga/haikyuu/chapter-052?id=283506#16
bundle.js:1 set cycle start for http://kissmanga.com/Manga/Haikyuu/Chapter-052?id=283506#17
chrome.tabs updated
bundle.js:1 chrome.tabs activated
bundle.js:1 Injecting content
bundle.js:1 Injected
TSedlar commented 6 years ago

You probably just need to restart the browser since it caches what (should) be tracked so that it doesn't keep executing the update code. (The same had happened to me when I was debugging)

Let me know if it works after you do that, and if it does I can try and get in contact with someone from Kitsu to allow a userid lookup via email if they do not have a profile url set.

TSedlar commented 6 years ago

Ahh nevermind I see the issue. Getting the base url for kissmanga does work, but I botched the grouping.

The base_url is ^[^?#]+ so it does not have a group(1), so I will change it to (^[^?#]+) and then it should work.

I'll update to 2.0.1 in a bit.

thibaultmol commented 6 years ago

Just tried out the new version... Realized halfway through testing that I wasn't logged in yet this time (was on a different partition on my pc than last time I think). And it seems like logging in while I'm already on a page breaks it:

chrome.tabs updated
bundle.js:1 set end cycle for http://kissmanga.com/manga/haikyuu/306---take-aim?id=425766#13
bundle.js:1 set cycle start for http://kissmanga.com/Manga/Haikyuu/306---Take-Aim?id=425766#14
bundle.js:1 chrome.tabs updated
_generated_background_page.html:1 Uncaught (in promise) Please click my icon and sign in to enable scrobbling
Promise.then (async)
(anonymous) @ bundle.js:1
EventImpl.dispatchToListener @ extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ extensions::utils:138
EventImpl.dispatch_ @ extensions::event_bindings:387
EventImpl.dispatch @ extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ extensions::utils:138
dispatchOnMessage @ extensions::messaging:392
2bundle.js:1 chrome.tabs activated
bundle.js:1 Injecting content
bundle.js:1 Injected
_generated_background_page.html:1 Uncaught (in promise) Please click my icon and sign in to enable scrobbling
Promise.then (async)
(anonymous) @ bundle.js:1
EventImpl.dispatchToListener @ extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ extensions::utils:138
EventImpl.dispatch_ @ extensions::event_bindings:387
EventImpl.dispatch @ extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ extensions::utils:138
dispatchOnMessage @ extensions::messaging:392
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/306---take-aim?id=425766#14
bundle.js:1 life: 22392
bundle.js:1 data:
bundle.js:1 {title: "Haikyuu!!", episode: 306, page: 14, pageCount: 18}
bundle.js:1 {id: "12619", type: "manga", links: {…}, attributes: {…}, relationships: {…}}
bundle.js:1 id: 12619
bundle.js:1 Updating list service...
bundle.js:1 totalEpisodes: NaN
bundle.js:1 status: current
bundle.js:1 updateMangaList(12619, current, 306)
bundle.js:1 chrome.tabs activated
bundle.js:1 {responseCode: 201, content: "{"data":{"id":"32963966","type":"libraryEntries","…api/edge/library-entries/32963966/next-unit"}}}}}"}
bundle.js:1 Updated!
5bundle.js:1 chrome.tabs updated
bundle.js:1 chrome.tabs activated
bundle.js:1 Injecting content
bundle.js:1 Injected
2bundle.js:1 chrome.tabs updated
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/295---demon-bird?id=410959
bundle.js:1 Uncaught (in promise) TypeError: Cannot read property 'end' of undefined
    at t.value (bundle.js:1)
    at bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
mc @ bundle.js:1
Xn @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
bundle.js:1 chrome.tabs updated
bundle.js:1 set end cycle for http://kissmanga.com/manga/haikyuu/306---take-aim?id=425766#14
bundle.js:1 set cycle start for http://kissmanga.com/Manga/Haikyuu/295---Demon-Bird?id=410959
bundle.js:1 chrome.tabs updated
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/295---demon-bird?id=410959
bundle.js:1 life: 7569
bundle.js:1 Uncaught (in promise) TypeError: Cannot read property '1' of null
    at e (bundle.js:1)
    at t.value (bundle.js:1)
    at bundle.js:1
e @ bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
mc @ bundle.js:1
Xn @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
2bundle.js:1 chrome.tabs updated
bundle.js:1 set end cycle for http://kissmanga.com/manga/haikyuu/295---demon-bird?id=410959
bundle.js:1 set cycle start for http://kissmanga.com/Manga/Haikyuu/295---Demon-Bird?id=410959#2
bundle.js:1 chrome.tabs updated
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/295---demon-bird?id=410959
bundle.js:1 life: 7873
bundle.js:1 Uncaught (in promise) TypeError: Cannot read property '1' of null
    at e (bundle.js:1)
    at t.value (bundle.js:1)
    at bundle.js:1
e @ bundle.js:1
value @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
mc @ bundle.js:1
Xn @ bundle.js:1
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
Promise.then (async)
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
setTimeout (async)
value @ bundle.js:1
(anonymous) @ bundle.js:1
bundle.js:1 Handling http://kissmanga.com/manga/haikyuu/295---demon-bird?id=410959
bundle.js:1 life: 7873
bundle.js:1 Uncaught (in promise) TypeError: Cannot read property '1' of null
    at e (bundle.js:1)
    at t.value (bundle.js:1)
    at bundle.js:1

EDIT: although opening the url in a different tab after that, does fix it

TSedlar commented 6 years ago

Hm? It looks like you're reading chapter 306 and then going to read 295?

It won't update if the current chapter you're reading is lower than the chapter you have marked as read on Kitsu/MAL.

I tried to have the error happen for me by doing:

And it added ch306 to my Kitsu.

Afterward I went to ch307 pg 14 to see if it would also update and it also updated my Kitsu to mark 307 as read.

I went back to ch295 to see what would happen like your case but wasn't met with any errors.

If everything worked after you used a new tab, it could just be from debugging the plugin repeatedly and having some cache clashes.

If everything is working fine do let me know so I can close the issue! :+1:

Thanks very much for the donation as well, much appreciated. 👍

thibaultmol commented 6 years ago

Yep! Looks perfect on my end! Thanks for fixing it that quickly!