opened
Ggwppino
username_0
Hi!
I've an error in AnimeParse.php, line 276, Undefined offset: 1541 when execute `$var->Anime(1)->response;`
I've another error in MangaParse.php, line 157, Undefined offset:1042 when I try `$var->Manga(1)->response;`
With `$var->Character(1)->response;` I've no problem.
have a nice Day! :)
Error with AnimeParse.php and MangaParse.php.
issue
created
irfan-dahir
username_1
Hello, I can't seem to reproduce the issue. Are you up to date with the latest Jikan release?
comment
created
Ggwppino
username_0
I've installed the last version: 1.15.9. I've installed it this morning.
comment
created
irfan-dahir
username_1
That's really odd. It could be you're getting a different HTML format for that part (MAL does this sometimes by IP location). I will look further into this.

Meanwhile, you can remove the `background` parsing rule from both `AnimeParse.php` and `MangaParse.php` to prevent this error by removing the method `$this->addRule('background', '~</div>Background</h2>~', function() {`; line 265 - 289 (AnimeParse.php) and line 146 - 168 (MangaParse.php) respectively.
comment
created
irfan-dahir
username_1
Can you get me an HTML dump of these two links?
- https://myanimelist.net/anime/1
- https://myanimelist.net/manga/1

Just paste their source into pastebin.
comment
created
Ggwppino
username_0
Ok, now `$anime->Anime(1)->response` and `$manga->Manga(1)->response` work. But now I have another problem :c : `$characterAnime->Anime(1,[CHARACTERS_STAFF])->response` and `$characterManga->Manga(1,[CHARACTER])->response` don't work. 
-  `$characterAnime->Anime(1,[CHARACTERS_STAFF])->response` Error on AnimeCharacterStaffParse.php, line 104, Undefined offset: 7229. before the error occurred metod create an array with (i,staff,person,match) but it doesn't create the array voice: 'characters' but i think That it still has to be created  https://pastebin.com/dVGErMS1(array before the error). 
-  `$characterManga->Manga(1,[CHARACTER])->response` Error on MangaCharacterParse.php, Line 28, Undefined offset: 911. before the error occurred metod create an array with voices (i,characters,character,image,name,role). the content of Characters is perfect but something generates and an error and so it doesn't work. https://pastebin.com/3vV4vP9V (array before the error).
comment
created
irfan-dahir
username_1
Hmm, this definitely mean MAL renders differently based on some specific geolocation. Could you kindly paste the source of those pages as well? It'll help me find common ground in the HTML. Thanks!
- https://myanimelist.net/anime/1/Cowboy_Bebop/characters
- https://myanimelist.net/manga/1/Monster/characters

Also, this could take a few days. I'm busy till Friday. Do let me know if this occurs over other requests you
comment
created
Ggwppino
username_0
I've fixed MangaCharacterParse.php changing `'~<div class="fl-r">~'` with `'~<div class="border_top" style="overflow: hidden;padding:20px 0;">~'` on line 28. I'll try with AnimeCharacterParse soon.
comment
created
irfan-dahir
username_1
Speaking of, what happened to your account? It went total 404, including this issue lol
comment
created
irfan-dahir
username_1
Haha wow, that's weird.

Great, you've found a temp fix. I'll look into the ones you've mentioned.
comment
created
coderiekelt
username_2
I am experiencing the same problem, got the same message yesterday which stopped at one exception, now however...
![yeah...](https://i.imgur.com/RBvmN6x.gif)

I'll see if I can come up with something useful like the Anime ID starts doing this, if it's any help, my servers are located in the Netherlands, so it's making requests from that geolocation.
comment
created
irfan-dahir
username_1
Gotcha, thanks for the input. I'll work on a patch for this today.
comment
created
irfan-dahir
username_1
I've identified the issue. I was using the Google Tag's HTML tag to perform a breakpoint in parsing, TIL it might not always show up by geolocation. I'll be more careful with this stuff in the future.

I've gone ahead and patched the following requests, please let me know whether it works or not.
Make sure to use `dev-master` instead of the current version in `composer.json`. You can directly do this too: `composer require jikan-me/jikan:dev-master`

`$jikan->Anime(1)->response`
`$jikan->Manga(1)->response`
`$jikan->Anime(1, [CHARACTERS_STAFF])->response`
`$jikan->Manga(1, [CHARACTERS])->response`


Furthermore, I have identified a few other requests that use that particular HTML tag to break the parse. Could you guys try out these endpoints and let me know they bugs out?
`$jikan->Anime(1, [PICTURES]);`
`$jikan->Character(1, [PICTURES]);`
`$jikan->Manga(1, [PICTURES]);`
`$jikan->Person(1, [PICTURES]);`
comment
created
coderiekelt
username_2
```
$jikan = new Jikan();
$response = $jikan->Anime(1, [PICTURES])->response;
$response = $jikan->Character(1, [PICTURES])->response;
$response = $jikan->Manga(1, [PICTURES])->response;
$response = $jikan->Person(1, [PICTURES])->response;
```

Worked fine from this end
comment
created
irfan-dahir
username_1
That's great. I'll wait for @username_0 to see if it works for him before closing the issue.
comment
created
Ggwppino
username_0
- `$jikan->Anime(1, [PICTURES]); `  undefined Offset:574; File:AnimePicturesParse, Line 26, Probably cause: <div class="fl-l">;
- `$jikan->Character(1, [PICTURES]); ` undefined Offset:399; File:CharacterPictureParse, Line 26, Probably cause: <div class="fl-l">;
- `$jikan->Manga(1, [PICTURES]);` undefined Offset:348; File:MangaPicturesParse, Line Line 26, Probably cause: <div class="fl-l">;
- `$jikan->Person(1, [PICTURES]);` undefined Offset:366; File:PersonPicuresParse, Line 26, Probably cause: <div class="fl-l">;
comment
created
Ggwppino
username_0
Me too error with id 12189 on AnimeParse.php:277 but Undefined offset: 1470.
comment
created
irfan-dahir
username_1
This is odd because the file you sent me parses without any errors, @username_2. That part of the code is also the same as mines. Did it perhaps generate an error from your server and you sent the source from your PC?

@username_0 Can you send me the source from your side for Anime 12189?
comment
created
coderiekelt
username_2
The paste I put in that post came from my own PC, snatched from Google Chrome.
I'm in about the same geolocation as my server though, so I figured that wouldn't make much of a difference.

Here's the HTML as fetched by my server:
WGET: http://paste.ubuntu.com/p/jcRcVMpmBY/
CURL: http://paste.ubuntu.com/p/tzSrsZCFQg/
comment
created
irfan-dahir
username_1
Thanks for that, @username_2. 

The HTML from the server is: 
```Background</h2>The first episode received an early screening at a special event held at Kadokawa Cinema Shinjuku on April 14, 2012. The regular TV broadcast started on April 23, 2012. </td></tr><tr><td class="pb24"><br>```

Whereas the HTML from your previous post is:
```Background</h2>The first episode received an early screening at a special event held at Kadokawa Cinema Shinjuku on April 14, 2012. The regular TV broadcast started on April 23, 2012. <div class="border_top" style="padding:16px 0px 0px 0px;margin:14px 0px 0px 0px;"><div style="padding: 20px 0 20px 40px; float: left; position: relative; z-index: 1;">```

Truly scratching my head here. I think it's rather by the headers sent or some other factor. Anyways, I've released a patch for it.
comment
created
coderiekelt
username_2
Just tested it, works absolutely fine now.

![celebratory gif](https://i.imgur.com/l5n5L.gif)
comment
created
irfan-dahir
username_1
@username_0 Pushed a patch for the pictures request. Can you confirm them working on your end now?


```
$jikan->Anime(1, [PICTURES])->response;
$jikan->Character(1, [PICTURES])->response;
$jikan->Manga(1, [PICTURES])->response;
$jikan->Person(1, [PICTURES])->response;
```
comment
created
Ggwppino
username_0
yup, it works very well now
comment
closed
irfan-dahir
username_1
issue
created
irfan-dahir
username_1
Great. I'll close this issue now. Please feel free to reopen this or a new one if any thing of sorts reoccurs.
comment