Example #1
0
def hindustantimes():

    print "which language do you prefer,select,language code from below"
    print newspaper.languages()
    print "user>>"
    lang = raw_input()
    print "plz wait.."
    cnn = newspaper.build("http://hindustantimes.com", language=lang)
    print "bot>>"
    print "top news"
    for article in cnn.articles:
        article.download()
        article.parse()
        print article.url
        print "do you want to see the full text here yes/no"
        print "user>>"
        s2 = raw_input()
        print "bot>>"
        if (s2 == "yes"):
            print article.text
        print "do you want to see the top image of the article yes/no"
        print "user>>"
        sr = raw_input()
        if (sr == "yes"):
            webbrowser.open_new(article.top_image)

        print "do you want to open in browser yes/no"
        print "user>>"
        s3 = raw_input()
        if (s3 == "yes"):
            webbrowser.open_new(article.url)
        print "bot>>"
        print "want to read more yes/no"
        s4 = raw_input()
        if (s4 != "yes"):
            break
        else:
            print "plz wait.."
Example #2
0
 def test_languages_api_call(self):
     newspaper.languages()
import newspaper
# hot() returns a list of the top trending terms on Google using a public api
print(newspaper.hot())
# popular_urls() returns a list of popular news source urls
print(newspaper.popular_urls())
newspaper.languages()
volkskrant = newspaper.build('https://www.volkskrant.nl/', language='nl')

print(volkskrant.size())

for category in volkskrant.category_urls():
    print(category)

for article in volkskrant.articles:
    print(article.url)

print('\n')

print(newspaper.hot(), end='\n\n')
print(newspaper.popular_urls(), end='\n\n')

print(newspaper.languages())

# url = 'https://www.volkskrant.nl/nieuws-achtergrond/eerste-dode-in-nederland-maar-wat-is-eigenlijk-de-kans-om-aan-corona-te-overlijden~bf716564/'
# article = newspaper.Article(url)
# article.download()

# article.parse()
# print(article.authors)
# article.publish_date
# article.text
# article.top_image

# article.nlp()
# article.keywords
# article.summary
Example #5
0
 def test_languages_api_call(self):
     newspaper.languages()
Example #6
0
def languages():
 	newspaper.languages()
Example #7
0
import newspaper
import time
print "Do you want to read the latest news"
print "\n"
print "1)To continue to read the paper\n2)To exit"
user_choice = input("Enter your choice")
if (user_choice == 1):
    time.sleep(5)
    print "You can get many languages"
    print "Following are the languages"

    print newspaper.languages()
    news = raw_input("Enter the excat name of the paper you need to read")
    urls = ('http://' + news + '.com')
    paper = newspaper.build(urls)
    print "Choose:"
    print "1.Articles \n2.Summary \n3.Category"
    user_input = input('enter your choice')
    if (user_input == 1):
        print paper
        count = 1
        for article in paper.articles:
            print str(count) + ')' + str(article.url)
            count = count + 1
        no = input('enter the index of the article to be read')
        article = paper.articles[no]
        article.download()
        article.parse()
        print article.authors
        print article.text
    elif (user_input == 2):