Question: Python Webcrawling - Using Newspaper to get information from 10 articles I'm working on a program to web crawl through cnn.com and pull the title,
Python Webcrawling - Using Newspaper to get information from 10 articles I'm working on a program to web crawl through cnn.com and pull the title, text, publish date, and url from the first 10 articles. For some reason, I can only get the url to print out while nothing shows up for the title, text, and publish date. Can someone guide me through fixing my code so that it will print out the title, text and publish date? This is my code so far: #The below three lines are for Newspaper import newspaper from newspaper import Article cnn_paper = newspaper.build('http://cnn.com', memoize_articles=False) article_list_1 = [] article_list_2 = [] article_list_3 = [] article_list_4 = []
for article in cnn_paper.articles: article_list_1.append(article.title)
for article in cnn_paper.articles: article_list_2.append(article.publish_date)
for article in cnn_paper.articles: article_list_3.append(article.text)
for article in cnn_paper.articles: article_list_4.append(article.url)
i = 0 while i
i = 0
while i
i = 0 while i
i = 0 while i
Here is a snippet of source code from Cnn.com for their site

This is the output for when I run the for loop to get the urls: 
nt-"I a/2.119.1/js/cnn-header-second.min.js ff2 anon Ps ti e height : [hidden] {display : none}html(font tio rsborder:0;padding:0textareafoverflow: auto; ical-align:toptablefborder-collapse:collaps 3.7.2/cnnsans-bold.ttf) format("truetype thinit.woff) format("woff" e );font-weight 4es; font-style italic}@font-face font faily:CNNSKur11 / .cdn.cnn.co fal n tsemM 1 m a s dlmte t) O a t enie ded per 2/cnnclock-italic.woff2) format("woff2 boldit.ttf) format("truetype");font font-style:italicj@font-faceffont-family: biz-regular.ttf) format("truetype");font-weight:400;fon cnn it;text-rendering:optimizelegibility;text-transfor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
