Hey all. I wanted to make a skin that would display the most recent album released by the artist of the song that is currently playing in itunes. Is it possible using webparser to get the last album released off itunes.com or last.fm or a similar site?
thanks!
It is currently April 28th, 2024, 12:10 pm
help with webparser
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
help with webparser
Last edited by closer2thelung on November 7th, 2014, 3:09 am, edited 1 time in total.
-
- Posts: 1740
- Joined: November 13th, 2012, 9:53 pm
Re: help with webparser
yes, it is possible.
Apple has a nice api for that:
https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
for the sorting, use YQL.
example Jack Johnson album names by release date:
https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName%2Cresults.releaseDate%20from%20json%20where%20url%3D"https%3A%2F%2Fitunes.apple.com%2Flookup%3Fid%3D909253%26entity%3Dalbum"%20%7C%20sort(field%3D"results.releaseDate"%2C%20descending%3D"true")&diagnostics=true
yes, this includes only albums released on iTunes. yes, this includes re-releases. yes, the release date probably means "released on iTunes".
Apple has a nice api for that:
https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
for the sorting, use YQL.
example Jack Johnson album names by release date:
Code: Select all
select results.collectionName,results.releaseDate from json where url="https://itunes.apple.com/lookup?id=909253&entity=album" | sort(field="results.releaseDate", descending="true")
yes, this includes only albums released on iTunes. yes, this includes re-releases. yes, the release date probably means "released on iTunes".
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
Re: help with webparser
thanks for the info but I'm not sure how to lay out the code you gave me. I know basic rainmeter pretty well but I have never used webparser before. Am I on the right track?
Code: Select all
[Rainmeter]
[Variables]
@include=#@#uservariables.inc
[MeasureParent]
Measure=Plugin
Plugin=WebParser
url=https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName%2Cresults.releaseDate%20from%20json%20where%20url%3D"https%3A%2F%2Fitunes.apple.com%2Flookup%3Fid%3D909253%26entity%3Dalbum"%20%7C%20sort(field%3D"results.releaseDate"%2C%20descending%3D"true")&diagnostics=true
RegExp="(?siU)<Item>(.*)</Item>.*<Item>(.*)</Item>"
[MeasureChild1]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1
[album]
meter=string
measurename=measurechild1
x=0
y=0
FontSize=14
FontColor=222,255,225,255
AntiAlias=1
-
- Posts: 1740
- Joined: November 13th, 2012, 9:53 pm
Re: help with webparser
well, no.closer2thelung wrote:Am I on the right track?
all you did was copying the example code from the docs and slapping the example url i gave you for sorting with YQL on it.
so, as you said yourself, there is a complete lack of understanding how the plugin or "parsing" in general works.
i would strongly recommend to do the tutorial on the webparser plugin before continuing. you'll find the link in the docs.
good luck with your project.
-
- Posts: 127
- Joined: September 12th, 2012, 10:49 pm
Re: help with webparser
I also recommend testing out your parsing creations using this tool.
Before I used it, I too had no understanding of how to parse information.
Before I used it, I too had no understanding of how to parse information.
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
Re: help with webparser
ok i spent a while trying to figure this out. i have a basic understanding of how webparser works. i figured out how to implement the code you provided and i have it working and displaying properly.
However i am having trouble substituting the artist ID in the url in order to search for other artists. I figured out how to parse for the artist ID but I cannot substitute that ID into the url.
You can see that where the original artist ID was in the URL, i tried to substitute it with [MeasureArtistID] from my first web parser. Am I doing something wrong? can i have 2 web parsers in one skin?
If i can figure this out then it would be a simple matter of substituting in the Artist Name from nowplaying.dll into the first webparsing url "https://itunes.apple.com/search?term=brand new/search?term=[ArtistName]
However i am having trouble substituting the artist ID in the url in order to search for other artists. I figured out how to parse for the artist ID but I cannot substitute that ID into the url.
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
;--- WEB PARSING ---:
[MeasureID]
Measure=Plugin
Plugin=WebParser
URL=https://itunes.apple.com/search?term=brand new
RegExp=(?siU)"artistId":(.*),
UpdateRate=3600
[MeasureReleaseInfo]
Measure=Plugin
Plugin=WebParser
URL=https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName
%2Cresults.releaseDate%20from%20json%20where%20url%3D%22https%3A%2F%2Fitunes.apple.com
%2Flookup%3Fid%3D[MeasureArtistID]%26entity%3Dalbum%22%20%7C%20sort(field%3D%22results.releaseDate%22%2C
%20descending%3D%22true%22)&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
RegExp=(?siU)<collectionName>(.*)</collectionName>(?siU)<releaseDate>(.*)T
UpdateRate=3600
;--- MEASURES ---:
[MeasureArtistID]
Measure=Plugin
Plugin=WebParser
URL=[MeasureID]
StringIndex=1
[MeasureAlbum]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=1
[MeasureDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=2
;--- METERS ---:
[MeterBackground]
Meter=Image
W=300
H=65
SolidColor=20,20,20,255
[MeterAlbumLabel]
Meter=String
X=5
Y=5
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
StringAlign=Left
AntiAlias=1
Text=Last Release:
[MeterAlbum]
Meter=String
MeasureName=MeasureAlbum
X=85r
Y=0r
W=195
H=15
FontSize=10
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
[MeterDateLabel]
Meter=String
X=5
Y=30r
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Release Date:
[MeterDate]
Meter=String
MeasureName=MeasureDate
X=88r
Y=0r
W=192
H=15
FontSize=11
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
If i can figure this out then it would be a simple matter of substituting in the Artist Name from nowplaying.dll into the first webparsing url "https://itunes.apple.com/search?term=brand new/search?term=[ArtistName]
Last edited by closer2thelung on November 3rd, 2014, 6:55 am, edited 1 time in total.
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
Re: help with webparser
ok I figured out how to apply the variables using writekeyvalue. so thats working. But i have to refresh the skin 2 or 3 times after every time the artist changes for the info to kick in. any idea why this is happening?
(i have it changing the variable, then refreshing every time i click on the background)
(i have it changing the variable, then refreshing every time i click on the background)
Code: Select all
[Rainmeter]
AccurateText=1
DynamicWindowSize=1
[Variables]
@include=#@#ParsingInfo.inc
;--- WEB PARSING ---:
[MeasureID]
Measure=Plugin
Plugin=WebParser
URL=https://itunes.apple.com/search?term=#ARTIST#
RegExp=(?siU)"artistId":(.*),
[MeasureReleaseInfo]
Measure=Plugin
Plugin=WebParser
URL=https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName%2Cresults.releaseDate%20from%20json%20where%20url%3D%22https
%3A%2F%2Fitunes.apple.com%2Flookup%3Fid%3D#ARTISTID#%26entity%3Dalbum%22%20%7C%20sort(field%3D%22results.releaseDate%22%2C%20descending%3D
%22true%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
RegExp=(?siU)"collectionName":"(.*)",(?siU)"releaseDate":"(.*)T
;--- MEASURES ---:
[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=itunes
PlayerType=ARTIST
[MeasureArtistID]
Measure=Plugin
Plugin=WebParser
URL=[MeasureID]
StringIndex=1
[MeasureAlbum]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=1
[MeasureDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=2
;--- METERS ---:
[MeterBackground]
Meter=Image
W=300
H=65
SolidColor=20,20,20,255
LeftMouseUpAction=[!WriteKeyValue Variables ArtistID [measureArtistID] "#@#ParsingInfo.inc"][!WriteKeyValue Variables Artist [measureArtist]
"#@#ParsingInfo.inc"][!refresh]
[MeterAlbumLabel]
Meter=String
X=5
Y=5
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
StringAlign=Left
AntiAlias=1
Text=Last Release:
[MeterAlbum]
Meter=String
MeasureName=MeasureAlbum
X=85r
Y=0r
W=195
H=15
FontSize=10
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
[MeterDateLabel]
Meter=String
X=5
Y=30r
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Release Date:
[MeterDate]
Meter=String
MeasureName=MeasureDate
X=88r
Y=0r
W=192
H=15
FontSize=11
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
-
- Posts: 1740
- Joined: November 13th, 2012, 9:53 pm
Re: help with webparser
forget about that !WriteKeyValue stuff you just wrote.
read this at least twice until you understand it (you'll need it again):
http://rainmeter.net/forum/viewtopic.php?f=111&t=16210
then try this:
read this at least twice until you understand it (you'll need it again):
http://rainmeter.net/forum/viewtopic.php?f=111&t=16210
then try this:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
;--- WEB PARSING ---:
[MeasureID]
Measure=Plugin
Plugin=WebParser
URL=https://itunes.apple.com/search?term=brand new
RegExp=(?siU)"artistId":(.*),
UpdateRate=3600
FinishAction=[!SetOption MeasureReleaseInfo Url "https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName%2Cresults.releaseDate%20from%20json%20where%20url%3D%22https%3A%2F%2Fitunes.apple.com%2Flookup%3Fid%3D[MeasureArtistID]%26entity%3Dalbum%22%20%7C%20sort(field%3D%22results.releaseDate%22%2C%20descending%3D%22true%22)&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" "#CURRENTCONFIG#"][!EnableMeasure MeasureReleaseInfo][!CommandMeasure MeasureReleaseInfo Update][!UpdateMeasure MeasureReleaseInfo]
[MeasureReleaseInfo]
Measure=Plugin
Plugin=WebParser
URL=""
RegExp=(?siU)<collectionName>(.*)</collectionName>.*<releaseDate>(.*)T
UpdateDivider=-1
Disabled=1
DynamicVariables=1
;--- MEASURES ---:
[MeasureArtistID]
Measure=Plugin
Plugin=WebParser
URL=[MeasureID]
StringIndex=1
[MeasureAlbum]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=1
[MeasureDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=2
;--- METERS ---:
[MeterBackground]
Meter=Image
W=300
H=65
SolidColor=20,20,20,255
[MeterAlbumLabel]
Meter=String
X=5
Y=5
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
StringAlign=Left
AntiAlias=1
Text=Last Release:
[MeterAlbum]
Meter=String
MeasureName=MeasureAlbum
X=85r
Y=0r
W=195
H=15
FontSize=10
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
[MeterDateLabel]
Meter=String
X=5
Y=30r
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Release Date:
[MeterDate]
Meter=String
MeasureName=MeasureDate
X=88r
Y=0r
W=192
H=15
FontSize=11
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
Re: help with webparser
ok i read through the link you gave. I ended up putting the nowplaying measure over the first webparser and changing the artist name to [&MeasureArtist]. It worked perfectly for a few hours. i would have to manually refresh the skin to have it take effect but it would work every time with a single refresh. Which was going to lead to my next question of having the skin update the information without having to refresh.....
But now this skin is not working at all. It is getting the artist ID but nothing else. And even using the same code in the YQL website tool only works once every 30 tries or so. Is something wrong? YQL site says there is a limit of 20,000 calls per hour. Am i somehow exceeded this?
Thanks for all your help so far by the way!
But now this skin is not working at all. It is getting the artist ID but nothing else. And even using the same code in the YQL website tool only works once every 30 tries or so. Is something wrong? YQL site says there is a limit of 20,000 calls per hour. Am i somehow exceeded this?
Thanks for all your help so far by the way!
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
;--- WEB PARSING ---:
[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=itunes
PlayerType=ARTIST
[MeasureID]
Measure=Plugin
Plugin=WebParser
URL=https://itunes.apple.com/search?term=[&MeasureArtist]
RegExp=(?siU)"artistId":(.*),
UpdateRate=3600
FinishAction=[!SetOption MeasureReleaseInfo Url "https://query.yahooapis.com/v1/public/yql?q=select%20results.collectionName
%2Cresults.releaseDate%20from%20json%20where%20url%3D%22https%3A%2F%2Fitunes.apple.com%2Flookup%3Fid%3D[MeasureArtistID]%26entity%3Dalbum
%22%20%7C%20sort(field%3D%22results.releaseDate%22%2C%20descending%3D%22true%22)&format=xml&env=store%3A%2F%2Fdatatables.org
%2Falltableswithkeys" "#CURRENTCONFIG#"][!EnableMeasure MeasureReleaseInfo][!CommandMeasure MeasureReleaseInfo Update][!UpdateMeasure
MeasureReleaseInfo]
[MeasureReleaseInfo]
Measure=Plugin
Plugin=WebParser
URL=""
RegExp=(?siU)<collectionName>(.*)</collectionName>.*<releaseDate>(.*)T
UpdateDivider=-1
Disabled=1
DynamicVariables=1
;--- MEASURES ---:
[MeasureArtistID]
Measure=Plugin
Plugin=WebParser
URL=[MeasureID]
StringIndex=1
[MeasureAlbum]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=1
DecodeCharacterReference=1
[MeasureDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=2
;--- METERS ---:
[MeterBackground]
Meter=Image
W=300
H=65
SolidColor=20,20,20,255
LeftMouseUpAction=[!refresh]
[MeterAlbumLabel]
Meter=String
X=5
Y=5
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
StringAlign=Left
AntiAlias=1
Text=Last Release:
[MeterAlbum]
Meter=String
MeasureName=MeasureAlbum
X=85r
Y=0r
W=195
H=15
FontSize=10
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
[MeterDateLabel]
Meter=String
X=5
Y=30r
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Release Date:
[MeterDate]
Meter=String
MeasureName=MeasureDate
X=88r
Y=0r
W=192
H=15
FontSize=11
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
-
- Posts: 72
- Joined: August 29th, 2013, 5:01 am
Re: help with webparser
Ok i got rid of using YQL all together. Now only parsing from apple. Working perfectly. Now back to the question i had before. Is it possible to have it update and re-parse without having to refresh the skin?
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
;--- WEB PARSING ---:
[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=itunes
PlayerType=ARTIST
[MeasureID]
Measure=Plugin
Plugin=WebParser
URL=https://itunes.apple.com/search?term=[&MeasureArtist]&limit=5
RegExp=(?siU)"artistId":(.*),
UpdateRate=3600
FinishAction=[!SetOption MeasureReleaseInfo Url "https://itunes.apple.com/lookup?id=[MeasureArtistID]&entity=album&limit=5&sort=recent"
"#CURRENTCONFIG#"][!EnableMeasure MeasureReleaseInfo][!CommandMeasure MeasureReleaseInfo Update][!UpdateMeasure MeasureReleaseInfo]
[MeasureReleaseInfo]
Measure=Plugin
Plugin=WebParser
URL=""
RegExp=(?siU)"collectionName":"(.*)",.*"releaseDate":"(.*)T
UpdateDivider=-1
Disabled=1
DynamicVariables=1
;--- MEASURES ---:
[MeasureArtistID]
Measure=Plugin
Plugin=WebParser
URL=[MeasureID]
StringIndex=1
[MeasureAlbum]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=1
DecodeCharacterReference=1
[MeasureDate]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReleaseInfo]
StringIndex=2
;--- METERS ---:
[MeterBackground]
Meter=Image
W=300
H=65
SolidColor=20,20,20,255
LeftMouseUpAction=[!refresh]
[MeterAlbumLabel]
Meter=String
X=5
Y=5
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
StringAlign=Left
AntiAlias=1
Text=Last Release:
[MeterAlbum]
Meter=String
MeasureName=MeasureAlbum
X=85r
Y=0r
W=195
H=15
FontSize=10
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1
[MeterDateLabel]
Meter=String
X=5
Y=30r
W=280
H=15
FontSize=10
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Release Date:
[MeterDate]
Meter=String
MeasureName=MeasureDate
X=88r
Y=0r
W=192
H=15
FontSize=11
FontColor=252,251,202,255
SolidColor=0,0,0,1
Padding=5,5,5,5
clipstring=1
StringAlign=Left
AntiAlias=1