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

title from opengraph can return None #258

Open
aniruddha-adhikary opened this issue Aug 10, 2016 · 1 comment
Open

title from opengraph can return None #258

aniruddha-adhikary opened this issue Aug 10, 2016 · 1 comment

Comments

@aniruddha-adhikary
Copy link

  File "/usr/local/lib/python2.7/dist-packages/goose/extractors/title.py", line 42, in clean_title
    title = title.replace(site_name, '').strip()
AttributeError: 'NoneType' object has no attribute 'replace'
aniruddha-adhikary added a commit to aniruddha-adhikary/python-goose that referenced this issue Aug 10, 2016
@ubi15
Copy link

ubi15 commented May 16, 2017

Also, the title may correspond to the website name thus being an empty string (or a string of trailing spaces) and result in an error at line 55, where title_words is now an empty list after the after title.split() of line 52.

I wrapped from line 52 up to title = u" ".join(title_words).strip() with an

if title_words:
    <former code>
else:
    title = ""

Hope this helps.

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

2 participants