9

I'm trying to use the Google custom search engine API to query Google News. The API is working great otherwise - but I want to get News results instead of web results.

I can't find a way to either restrict the CSE to use Google News, or to ensure that my API query hits Google News rather than the web search. Does anyone know a way to achieve this?

Kara
  • 6,115
  • 16
  • 50
  • 57
zaump
  • 147
  • 2
  • 12

2 Answers2

8

You can use schemas from Schema.org to specify if you're only looking for articles/ blog posts.

To specify the Schema, go to Advanced settings on the Control Panel and select the required schema from here.

Shiv
  • 332
  • 4
  • 12
  • Thanks! That's really useful to know. – zaump Aug 21 '15 at 16:20
  • Np! Sorry the Control Panel link is probably just taking you to the sign-in page. – Shiv Aug 28 '15 at 18:27
  • I've actually worked on this and Google CSE is pretty far from ideal for making a news search engine. Schema.org types flag lots of nested content. – Kevin Caravaggio Jun 01 '17 at 18:50
  • To people who are looking for the location to specify "Schema": it is NOT in the Advanced settings as of this writing. It is in Setup(Left menu) > Basic > Restrict Pages using Schema.org Types. Then according to Schema.org, the value entered should be "NewsArticle" – Ellery Leung Feb 27 '21 at 15:48
5

There was a News Search API but it's deprecated:

Important: The Google News Search API has been officially deprecated as of May 26, 2011. It will continue to work as per our deprecation policy, but the number of requests you may make per day may be limited.

https://developers.google.com/news-search/

You can see some alternatives SO users recommended on this question.

Community
  • 1
  • 1
alestanis
  • 21,519
  • 4
  • 48
  • 67
  • You're welcome :) don't forget to upvote / accept if I helped. And welcome to StackOverflow! – alestanis Oct 22 '12 at 08:50
  • Update: I'm using [feedparser](http://packages.python.org/feedparser/introduction.html) and building RSS queries on the fly. Seems to work, though time will tell whether my IP gets banned for interface abuse :) – zaump Oct 22 '12 at 09:43