question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

different between demo website and python code

See original GitHub issue

Hi,

I use your demo web site to extract a CNN news, but I found the results are different. The url is http://edition.cnn.com/2014/03/27/sport/brooklyn-nets-owner-russia/index.html

By your demo website, it will show

Pro basketball is a staple of American athletics…

But I use python to get text by “Article.text”, it will show

Story highlights Russian billionaire owner of Nets considers ownership move to Russian jurisdiction

The move is “not in any way tying it to the current political situation,” the owner’s rep said

Obama signed an order that can target Russian companies vital to its economy

Pro basketball is a staple of American athletics, taking its place with Major…

Did I use the wrong method? My python is 3.6 and newspaper3k is 0.2.2.

from newspaper import Article

def news_extract(news_url):
    article = Article(news_url, fetch_images=False,)
    article.download()
    article.parse()
    text = article.text
    print(text)

source = 'http://edition.cnn.com/2014/03/27/sport/brooklyn-nets-owner-russia/index.html'
news_extract(source)

Thank you

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yprezcommented, Sep 12, 2017

@moveurbody I think that the demo website runs on an older version of newspaper (on the python-2 branch). This should explain the different results you’re getting…

1reaction
alexwilsoncommented, Sep 11, 2017

Hey, I think you might want to call article.nlp() and then access the content via article.summary?

Read more comments on GitHub >

github_iconTop Results From Across the Web

13 Real-World Examples of Python in Web Development
Which tech companies of today are great examples of Python in web development? From Netflix to Instagram, we've picked 13 out of the...
Read more >
Python Web Applications: Deploy Your Script as a Flask App
In this tutorial, you'll learn how to go from a local Python script to a fully deployed Flask web application that you can...
Read more >
Python Website Full Tutorial - Flask, Authentication ... - YouTube
In this video, I'm going to be showing you how to make a website with Python, covering Flask, authentication, databases, and more.
Read more >
Selenium with Python Tutorial: How to run Automated Tests
Read step-by-step Selenium Python Tutorial. Learn how to run your first automation tests in Selenium and Python using code samples and examples.
Read more >
How To Build a Website With Python - Digital.com
Python is becoming the internet coding language of choice due to its versatility. Learn how to build a website with Python from our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found