PersonParser: Member Favorites above 1000 are divided by 1000 because of comma

Issue #138 resolved
Dimitri Bervoets created an issue

I don't know exactly what happend but I guess that the MAL website started using a comma for the voice actor member favorites.

I noticed today that quite a famous voice actor 'Park, Romi' had a 'Member Favorites' count of 9 in my database. When I checked on the MAL website, she had a 'Member Favorites' count of 9,937.

A second example 'Sawashiro, Miyuki' had 20 in my database and 20,945 on the MAL website.

In my database, I filtered on my voice actors which still had a favorite count of more than 1000. The latest time of last update is '2017-02-08 21:00:06' so between that time and now there has been a change.

I already solved the bug as per example of the solution in the AnimeParser.

Lines 108-112 should be replaced by the following:

        # Favorites count
        $extracted = $leftcolumn->filterXPath('//span[text()="Member Favorites:"]');
        if ($extracted->count() > 0) {
            $extracted = str_replace($extracted->text(), '', $extracted->parents()->text());
            //PHP doesn't like commas in integers. Remove it.
            $extracted = trim(str_replace(',', '', $extracted));
            $personrecord->setFavoritedCount((int) $extracted);
        }

I'm curious if other users noticed this phenomenon ...

Comments (3)

  1. Ratan Dhawtal
    $extracted = trim(str_replace(',', '', $extracted));
    

    Kommas are being removed. We should check the $extracted value.

  2. Log in to comment