It is currently July 27th, 2024, 6:32 am

Automatically switch rss reader

Get help with creating, editing & fixing problems with skins
dasiun
Posts: 30
Joined: January 27th, 2021, 8:05 pm

Automatically switch rss reader

Post by dasiun »

Hi! I'll try to be specific.

I want my skin to show a rss feed from google news, then 10 seconds later, show another rss feed from google news, and so...

At least 10 diferent news articles, without title (Google News).

The attached image shows what i mean.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7785
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Automatically switch rss reader

Post by Yincognito »

dasiun wrote: May 15th, 2024, 9:03 pm Hi! I'll try to be specific.

I want my skin to show a rss feed from google news, then 10 seconds later, show another rss feed from google news, and so...

At least 10 diferent news articles, without title (Google News).

The attached image shows what i mean.
First of all, besides simpler samples that can be used as a direction to pursue, we don't do skin requests on this forum, the only thing we can and will do is help YOU write your own skin.

Secondly, what you want is not exactly trivial. A tutorial on getting RSS / Atom feeds already exists in the manual, and can be adapted to work with your source of feeds, if by any chance you don't retrieve them yet (make sure that you actually try to understand how to do it, instead of just copy pasting stuff, as some of the ideas there might help you in other places in your code):
https://docs.rainmeter.net/tips/rss-feed-tutorial/
There are also simpler skins already querying for Google News RSS feeds here on the forum or on DeviantArt, which you could use as an inspiration, if you don't have that part done (which is not 100% clear from your screenshots).

Thirdly, once you have either a sufficient number of retrieved RSS "items" or, if ambitious, all of them - albeit that might need you to first capture the entire "item" with StringIndex and then extract the desired tags from the its measure with StringIndex2, since the number of captures you can retrieve with either is limited to 99 as per the manual - ,:
https://docs.rainmeter.net/tips/webparser-using-stringindex2/
we can think about switching from one item to the next every 10 seconds, as that's just a matter of using a bang like !SetVariable:
https://docs.rainmeter.net/manual/bangs/#SetVariable
to increment (in the OnUpdateAction of some measure updated every 10 seconds via UpdateDivider) some ItemIndex variable storing the current item index, and using it like MeasureName=Item#ItemIndex#Title in the relevant meter (I know you don't want the title, I just used it as an example here). Obviously, the !SetVariable should be followed by properly updating all meters and redrawing the skin (like [!UpdateMeter *][!Redraw]), and the meters should have DynamicVariables=1 added to them, so that the changes are reflected visually.

So yeah, it's a bit of work and reading a few things from the manual in order to achieve your objective, and might seem confusing if you've never done it before, but it's possible and you get the idea it will become clearer and make more sense.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
dasiun
Posts: 30
Joined: January 27th, 2021, 8:05 pm

Re: Automatically switch rss reader

Post by dasiun »

Yeah, for me is really complicated, i have never done it before.

Where do i make skin requests ??
User avatar
Yincognito
Rainmeter Sage
Posts: 7785
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Automatically switch rss reader

Post by Yincognito »

dasiun wrote: May 16th, 2024, 5:44 pm Yeah, for me is really complicated, i have never done it before.
Well, there is always a first time for everything, if you really want it. All of us started as beginners at one time, and encountered the same difficulties as you do now, with stuff seeming more complicated than it really was. As they say, no pain, no gain - can't expect someone else to do the job for you if yourself are not willing to give it a try. :confused:
dasiun wrote: May 16th, 2024, 5:44 pm Where do i make skin requests ??
You don't, at least not on this forum - see here. :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
dasiun
Posts: 30
Joined: January 27th, 2021, 8:05 pm

Re: Automatically switch rss reader

Post by dasiun »

The Google RSS feed does not work with the example given in the Rainmeter tutorial.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
Item=(?(?=.*<entry>).*<entry>.*<updated>(.*)</updated>.*<link.*"(.*)".*<title.*>(.*)</title>)
Sub="^\s+":"","<!\[CDATA\[":"","\]\]>":"","!\[CDATA\[":"","\]\]":""

[MeasureSite]
Measure=WebParser
URL=https://news.google.com/?hl=en-US&gl=US&ceid=US:en
RegExp=(?siU)<title>(.*)</title>.*<link.*"(.*)".*<updated>(.*)</updated>#Item##Item##Item##Item##Item#

;Site info

[MeasureSiteTitle]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureSiteLink]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2

[MeasureSiteDate]
Measure=WebParser
URL=[MeasureSite]
StringIndex=3

;Item 1 info

[MeasureItem1Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=4
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem1Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=5

[MeasureItem1Date]
Measure=WebParser
URL=[MeasureSite]
StringIndex=6

;Item 2 info

[MeasureItem2Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=7
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem2Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=8

[MeasureItem2Date]
Measure=WebParser
URL=[MeasureSite]
StringIndex=9

;Item 3 info

[MeasureItem3Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=10
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem3Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=11

[MeasureItem3Date]
Measure=WebParser
URL=[MeasureSite]
StringIndex=12

;Item 4 info

[MeasureItem4Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=13
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem4Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=14

[MeasureItem4Date]
Measure=WebParser
URL=[MeasureSite]
StringIndex=15

;Item 5 info

[MeasureItem5Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=16
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem5Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=17

[MeasureItem5Date]
Measure=WebParser
URL=[MeasureSite]
StringIndex=18

;MeterStyles

[TextStyle]
X=5
Y=3R
W=290
H=40
FontFace=Segoe UI
FontSize=11
FontColor=255,255,255,255
SolidColor=0,0,0,1
ClipString=1
AntiAlias=1
ToolTipWidth=300

;Meters

[MeterBackground]
Meter=Image
W=300
H=255
SolidColor=50,50,50,255

[MeterSite]
Meter=String
MeasureName=MeasureSiteTitle
MeterStyle=TextStyle
H=20
Y=5
FontColor=196,245,184,255
StringStyle=Bold
LeftMouseUpAction=["[MeasureSiteLink]"]
ToolTipText=%1#CRLF#[MeasureSiteDate]
DynamicVariables=1

[MeterItem1]
Meter=String
MeasureName=MeasureItem1Title
MeterStyle=TextStyle
Y=10R
LeftMouseUpAction=["[MeasureItem1Link]"]
ToolTipText=%1#CRLF#[MeasureItem1Date]
DynamicVariables=1

[MeterItem2]
Meter=String
MeasureName=MeasureItem2Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem2Link]"]
ToolTipText=%1#CRLF#[MeasureItem2Date]
DynamicVariables=1

[MeterItem3]
Meter=String
MeasureName=MeasureItem3Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem3Link]"]
ToolTipText=%1#CRLF#[MeasureItem3Date]
DynamicVariables=1

[MeterItem4]
Meter=String
MeasureName=MeasureItem4Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem4Link]"]
ToolTipText=%1#CRLF#[MeasureItem4Date]
DynamicVariables=1

[MeterItem5]
Meter=String
MeasureName=MeasureItem5Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem5Link]"]
ToolTipText=%1#CRLF#[MeasureItem5Date]
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5452
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Automatically switch rss reader

Post by eclectic-tech »

dasiun wrote: May 16th, 2024, 8:01 pm The Google RSS feed does not work with the example given in the Rainmeter tutorial.

EDIT: Where did you get that code? It is NOT in any of the tutorials I found in the manual...

As for the posted code, "Yes", it does not work because Google changed their news site...

Here is an updated version that will work as an example:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
Item=(?(?=.*<item>).*<item>.*<title>(.*)</title>.*<link>(.*)</link>)
Sub="^\s+":"","<!\[CDATA\[":"","\]\]>":"","!\[CDATA\[":"","\]\]":""

[MeasureSite]
Measure=WebParser
URL=https://news.google.com/news/feeds?output=rss
RegExp=(?siU)<title>(.*)</title>.*<link>(.*)</link>#Item##Item##Item##Item##Item#

;Site info

[MeasureSiteTitle]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureSiteLink]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2

;Item 1 info

[MeasureItem1Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=3
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem1Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=4

;Item 2 info

[MeasureItem2Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=5
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem2Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=6

;Item 3 info

[MeasureItem3Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=7
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem3Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=8

;Item 4 info

[MeasureItem4Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=9
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem4Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=10

;Item 5 info

[MeasureItem5Title]
Measure=WebParser
URL=[MeasureSite]
StringIndex=11
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#Sub#

[MeasureItem5Link]
Measure=WebParser
URL=[MeasureSite]
StringIndex=12

;MeterStyles

[TextStyle]
X=5
Y=4R
W=290
H=40
FontFace=Segoe UI
FontSize=11
FontColor=255,255,255,255
SolidColor=0,0,0,1
ClipString=1
AntiAlias=1
ToolTipWidth=300

;Meters

[MeterBackground]
Meter=Image
W=300
H=265
SolidColor=50,50,50,255

[MeterSite]
Meter=String
MeasureName=MeasureSiteTitle
MeterStyle=TextStyle
H=20
Y=5
FontColor=196,245,184,255
StringStyle=Bold
LeftMouseUpAction=["[MeasureSiteLink]"]
ToolTipText=%1
DynamicVariables=1

[MeterItem1]
Meter=String
MeasureName=MeasureItem1Title
MeterStyle=TextStyle
Y=10R
LeftMouseUpAction=["[MeasureItem1Link]"]
ToolTipText=%1
DynamicVariables=1

[MeterItem2]
Meter=String
MeasureName=MeasureItem2Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem2Link]"]
ToolTipText=%1
DynamicVariables=1

[MeterItem3]
Meter=String
MeasureName=MeasureItem3Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem3Link]"]
ToolTipText=%1
DynamicVariables=1

[MeterItem4]
Meter=String
MeasureName=MeasureItem4Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem4Link]"]
ToolTipText=%1
DynamicVariables=1

[MeterItem5]
Meter=String
MeasureName=MeasureItem5Title
MeterStyle=TextStyle
LeftMouseUpAction=["[MeasureItem5Link]"]
ToolTipText=%1
DynamicVariables=1
User avatar
Yincognito
Rainmeter Sage
Posts: 7785
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Automatically switch rss reader

Post by Yincognito »

dasiun wrote: May 16th, 2024, 8:01 pm The Google RSS feed does not work with the example given in the Rainmeter tutorial.
Well, eclectic-tech already found that the address was the problem, so now you mostly only have point 3 above, the hard work is behind you thanks to the manual. Even if you wrote everything already done by yourself, if you look closely at the code, it's mainly lots of repetitive stuff, with only a few places where the "secret" of it is located, so not that much of an effort as it seemed at first, is it? :)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth