Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while fetching anime info. #3

Open
nins-k opened this issue May 15, 2015 · 6 comments
Open

Error while fetching anime info. #3

nins-k opened this issue May 15, 2015 · 6 comments

Comments

@nins-k
Copy link

nins-k commented May 15, 2015

Started getting this error while retrieving info on any anime about a week ago.

AttributeError: 'NoneType' object has no attribute 'parent' 
(file "/usr/local/lib/python2.7/dist-packages/myanimelist/media.py", line 193, in parse)

I had no idea what to do so I tried commenting out the following lines (193-195) which restored partial functionality.

synopsis_elt = media_page.find(u'h2', text=u'Synopsis').parent
utilities.extract_tags(synopsis_elt.find_all(u'h2'))
media_info[u'synopsis'] = synopsis_elt.text.strip()

This let me fetch an anime's title, rank, score, episodes but keeps returning NoneType for every call to anime.related

The complete nosetests results are in this gist.

This API is really awesome so hoping it'll be fixed.
Thanks!

@MartynasZilinskas
Copy link
Contributor

I got that error too. I will try look in that problem.
EDIT: I found out, that newest HTML update caused this library to crash. I will try fix it.

@nins-k
Copy link
Author

nins-k commented May 28, 2015

Thanks, that would be great!

@MartynasZilinskas
Copy link
Contributor

Well I made temporary fix... because I couldn't make it find 'Synopsis' with BS4...
https://github.com/martiogalalt/python-mal/commit/46dc3aa267e9dd1a28e4eb29d2b37439026f4e33

    # Lame Fix
    synopsis_elt = media_page.find_all(u'h2')

    for item in synopsis_elt:
      if 'Synopsis' in item.text:
        synopsis_elt = item.parent

    utilities.extract_tags(synopsis_elt.find_all(u'h2'))

    for item in synopsis_elt(["script", "style"]):
      item.extract()

    media_info[u'synopsis'] = synopsis_elt.text.strip()

@shaldengeki
Copy link
Owner

Sorry I've been unreachable; I'll take a look at this this weekend, since it looks like there's some changes that need to be made to pass all the tests.

@nins-k
Copy link
Author

nins-k commented May 30, 2015

Oh, that's great :)
In the meantime, thanks for your temporary fix @martiogalalt.

@rachmadaniHaryono
Copy link

if anyone want to find the repo with working fix, there are my repo and @pushrbx, which are still actively updated. If you are looking for python 3 only package (as in #10) try the fork from @pushrbx, because his fork only support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants