How to Scrape Bing News Results
News is crucial in our world. Bing News is an aggregated News platform that contains news articles from various sources, a wide range of topics and you can access it easily on Bing News.
If you want to customize your news feed based on specific topics, keywords, sources or research news data for analysis, trends, public reactions, etc. Bing News is definitely a valuable resource.
Furthermore, Bing News is multimedia-rich, better at categorizing topics than Google News.
SerpApi has a high-quality Bing News scraper, which provides Bing News APIs for you. You can scrape all of Bing News without worrying about blocking IP or resolving captchas, or other issues.
Scrape your first Bing News results with SerpApi
Head to the Bing News Results documentation on SerpApi for details.
In this tutorial, we will scrape and extract the organic results for all "football" news. The data contains: "title", "link", "date", "source", "snippet", "thumbnail", and more. You can also scrape more information with SerpApi.
First, you need to install the SerpApi client library.
pip install google-search-results
Set up the SerpApi credentials and search.
import serpapi, os, json
params = {
'api_key': 'YOUR_API_KEY', # your serpapi api
'engine': 'bing_news', # SerpApi search engine
'q': 'Football'
}
To retrieve Bing News Results for a given search query, you can use the following code:
client = serpapi.Client()
results = client.search(params)['organic_results']
You can store Bing News Results JSON data in databases or export them to a CSV file.
import csv
header = ['title', 'link', 'date', 'source', 'snippet', 'thumbnail']
with open('bing_news.csv', 'w', encoding='UTF8', newline='') as f:
writer = csv.writer(f)
writer.writerow(header)
for item in results:
print(item)
writer.writerow([item.get('title'), item.get('link'), item.get('date'), item.get('source'), item.get('snippet'), item.get('thumbnail')])
This example is using Python, but you can use your favorite programming languages like Ruby, NodeJS, Java, PHP, etc.
You can check out https://serpapi.com/blog/how-to-scrape-google-news/ if you're curious about Google News.
If you have any questions, please feel free to contact me.