It is currently April 28th, 2024, 2:03 pm

Google news

Get help with creating, editing & fixing problems with skins
MMZephyr
Posts: 3
Joined: January 7th, 2013, 6:05 am

Google news

Post by MMZephyr »

Hey, I'm wondering how I'd get google news feeds with rainmeter? I'd like one that shows me the top stories of the day, and also one that allows me to customize a search term so that I can search, say, for "apple" and I'd get apple news. Thanks.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Google news

Post by jsmorley »

There are tons of RSS feed skins that you can modify to use the URL:

Url=http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss

To get the latest headlines from Google News.

As to doing searches, that is more complicated. It would take a combination of an InputText plugin measure to capture your input, along with some Lua scripting to parse the feed and return only the items that match the search. It is doable, but would be a fair to middling project...
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Google news

Post by moshi »

you make this just like any other news skin.

you'll find the address of the feed at the bottom of the site (depends on your locale).

for example for trending news:

Code: Select all

http://news.google.de/news?pz=1&cf=all&ned=de&hl=de&output=rss
for example for news on Apple:

Code: Select all

https://news.google.at/news/feeds?hl=de&gl=at&q=apple&um=1&ie=UTF-8&output=rss
now you just need to replace the "apple" part with a user defined variable:

Code: Select all

https://news.google.at/news/feeds?hl=de&gl=at&q=#NewsSearch#&um=1&ie=UTF-8&output=rss
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Google news

Post by moshi »

jsmorley wrote: As to doing searches, that is more complicated. It would take a combination of an InputText plugin measure to capture your input, along with some Lua scripting to parse the feed and return only the items that match the search. It is doable, but would be a fair to middling project...
lua is not required, as you can see in the feed addresses in my post above.

i made a skin that does searches (for the news it uses Faroo, but might include Google News in the next version).
Untitled-1.jpg
it's available here: http://customize.org/rainmeter/skins/91081
but be warned, it's not that easy to understand, and even harder to explain. (i'm talking to the average user here)
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Google news

Post by jsmorley »

moshi wrote: lua is not required, as you can see in the feed addresses in my post above.

i made a skin that does searches (for the news it uses Faroo, but might include Google News in the next version).
Untitled-1.jpg
it's available here: http://customize.org/rainmeter/skins/91081
but be warned, it's not that easy to understand, and even harder to explain.
The only issue I would have with not using Lua is that if your search term returns no items, or less items than you have coded for in the child measures and associated meters, your skin might behave quite strangely, return a lot of errors in the log, and display a lot of empty meters. With Lua you can get a count of returned items, and then hide or show meters as needed, along with making the background of the skin size to fit the amount of returned items.

However, your approach at at high level is certainly easier, and might well work well enough for most needs.

Here is a skin I did that does something like this for the site "Breaking News", that allows highlighting "keywords" in the feed, using an InputText measure and some Lua. It is also fairly complicated, but could reasonably easily be modified to do Google News instead. This doesn't "restrict" the items to ones matching the search, but displays the entire feed (well, the first 10 items in this case) while using color to highlight both "new" items and ones matching your search.

User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Google news

Post by jsmorley »

That is the beauty of Rainmeter... There are always at least 10 ways to get where you need to go. ;-)
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Google news

Post by moshi »

jsmorley wrote:The only issue I would have with not using Lua is that if your search term returns no items, or less items than you have coded for in the child measures and associated meters, your skin might behave quite strangely, return a lot of errors in the log, and display a lot of empty meters. With Lua you can get a count of returned items, and then hide or show meters as needed, along with making the background of the skin size to fit the amount of returned items.
it behaves quite well. default is five items:
Untitled-1.jpg
Untitled-2.jpg
the reason it behaves are (of course) look-ahead regular expressions. and the use of invisible "dummy" meters.

Code: Select all

[MeterDummy1]
Meter=STRING
Text="[MeasureNews1Title]"
X=37
Y=(([EviBackTop2:Y])+41)
FontColor=ffffff00
SolidColor=ff000000
FontSize=11
FontFace=Source Sans Pro
StringStyle=NORMAL
Antialias=1
Hidden=1
Group=EviFull2
DynamicVariables=1
StringAlign=RIGHT

[News1Kwic]
Meter=STRING
MeasureName=MeasureNews1Kwic
Text="%1"
X=42
Y=(([News1Back:Y])+65)
W=246
H=((([MeterDummy1:H])/20)*33)
ClipString=1
FontColor=50506e
FontSize=((([MeterDummy1:H])/20)*7)
FontFace=Cambria
StringStyle=NORMAL
Antialias=1
Hidden=1
Group=EviFull2
DynamicVariables=1
SolidColor=ffffff00
You do not have the required permissions to view the files attached to this post.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Google news

Post by moshi »

two more things to consider:

the feeds have a limited number of entries (lets say 50, i did not count).
so if you parse the main feed:

Code: Select all

http://news.google.de/news?pz=1&cf=all&ned=de&hl=de&output=rss
for "Apple" and there is no news on it among the first 50 entries you are out of luck.
this feed:

Code: Select all

https://news.google.at/news/feeds?hl=de&gl=at&q=apple&um=1&ie=UTF-8&output=rss
on the other hand displays the first 50 news related to Apple.

and the Google api probably does a much better job searching for multiple keywords than a lua script could.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Google news

Post by jsmorley »

moshi wrote:two more things to consider:

the feeds have a limited number of entries (lets say 50, i did not count).
so if you parse the main feed:

Code: Select all

http://news.google.de/news?pz=1&cf=all&ned=de&hl=de&output=rss
for "Apple" and there is no news on it among the first 50 entries you are out of luck.
this feed:

Code: Select all

https://news.google.at/news/feeds?hl=de&gl=at&q=apple&um=1&ie=UTF-8&output=rss
on the other hand displays the first 50 news related to Apple.

and the Google api probably does a much better job searching for multiple keywords than a lua script could.
That is true.
MMZephyr
Posts: 3
Joined: January 7th, 2013, 6:05 am

Re: Google news

Post by MMZephyr »

I tried putting

Code: Select all

http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss
into the RSS feed in omnimo and when I click the appropriate button it doesn't open it up as if it doesn't work. In other words, the link isn't working :P