0

I need to fetch all articles link from a single page and I tried to do this using both libraries python scrapy and beautifulsoup but actually nothing coming out
Scrapy version

import scrapy


class CnnSpider(scrapy.Spider):
    name = "cnn"
    start_url = ['https://edition.cnn.com/business/india/index.html']

    def parse(self, response):
        for links in response.css('span.cd__headline-text'):
            print(links)

BeautifulSoup version

def links():
    url = "https://edition.cnn.com/business/india/index.html"
    page = requests.get(url)
    soup = BeautifulSoup(page.content, "html.parser")
    l = soup.find_all('span',class_="cd__headline-text")
    for element in l :
        print(element)

both function not printing any data and im sure about the element and the css class enter image description here

Marco
  • 842
  • 6
  • 18
  • 42

0 Answers0