web scraping google news with python

前端 未结 3 1361
渐次进展
渐次进展 2020-12-08 22:59

I am creating a web scraper for different news outlets, for Nytimes and the Guardian it was easy since they have their own API.

Now, I want to scrape results from th

3条回答
  •  一个人的身影
    2020-12-08 23:07

    hi you can scrap like this with easy way

    from bs4 import BeautifulSoup
    import requests
    
    url="https://news.google.co.in/"
    code=requests.get(url)
    soup=BeautifulSoup(code.text,'html5lib')
    for title in soup.find_all('span',class_="titletext"):
    print title.text
    

提交回复
热议问题