Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jywarren/ruby-googlenews
A library for fetching Google News articles as native Ruby objects
https://github.com/jywarren/ruby-googlenews
Last synced: about 2 months ago
JSON representation
A library for fetching Google News articles as native Ruby objects
- Host: GitHub
- URL: https://github.com/jywarren/ruby-googlenews
- Owner: jywarren
- License: mit
- Created: 2009-12-09T11:32:50.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2010-02-25T14:17:13.000Z (almost 15 years ago)
- Last Synced: 2024-10-14T08:15:11.434Z (3 months ago)
- Language: Ruby
- Homepage: http://unterbahn.com/2009/08/google-news-library-for-ruby/
- Size: 68.4 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
I was surprised that Google News has no API, so I built my own: Using HTTParty, I wrote a small Ruby library for Google News. Use it to grab google news stories and topic lists as native Ruby objects.
== Quick start:
Put ‘googlenews.rb’ file in the /lib/ directory of your Rails application
Googlenews.items() returns 10 of the most recent top stories.
== Full API:
# Get articles for all available languages.
# Pass it a # of articles and an array of language codes for which you want articles.
Googlenews.international(num,languages)
num: (integer) number of articles you want. Limit is 30, default is 10.
languages: (array) ex: ['es_ar','us','uk'] means Argentinian Spanish, US English and UK English. All possibilities:
"es_ar","au","nl_be","fr_be","en_bw","pt-BR_br","ca","fr_ca","cs_cz","es_cl","es_co","es_cu","de","es","es_us","en_et","fr","en_gh","in","en_ie","en_il","it","en_ke","hu_hu","en_my","es_mx","en_na","nl_nl","nz","en_ng","no_no","de_at","en_pk","es_pe","en_ph","pl_pl","pt-PT_pt","de_ch","fr_sn","en_sg","en_za","fr_ch","sv_se","en_tz","tr_tr","uk","us","en_ug","es_ve","vi_vn","en_zw","el_gr"# Get latest 10 or more articles
Googlenews.items(num)
num: (integer) number of articles you want. Limit is 30, default is 10.# Extract a topic id (string) from an article object
Googlenews.extract_topic(item)
item: (object) an article object like those returned by Googlenews.items()# Get articles for a topic, given an article object
Googlenews.topic(num)
num: (integer) number of articles you want. Limit is 30, default is 10.