It is currently March 28th, 2024, 7:08 pm

Parsing dogecoin price

Get help with creating, editing & fixing problems with skins
TimmyT1983
Posts: 12
Joined: December 22nd, 2020, 10:39 pm

Parsing dogecoin price

Post by TimmyT1983 »

hey, just trying to get the "price" from this:
https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE

which is:

Code: Select all

{"timestamp":"2021-02-01T10:30:01.673Z","error":false,"status":200,"message":"OK","data":{"currency":{"DOGE":{"name":"Dogecoin","slug":"dogecoin","iso":"DOGE","circulatingSupply":128061945503.677,"priceInBTC":0.0000011635204137922225,"quotes":{"USD":{"iso":"USD","name":"United States Dollar","slug":"united-states-dollar","change24Hr":{"percent":44.63260491878737,"value":0.0123477129},"price":0.040012943,"volume24Hr":64577526593.7326,"marketCap":5124135326.30645,"open":0.0276652301,"low":0.0271708115,"high":0.0491709685,"close":0.040012943}}}}}}
right now i'm just using this for the webparser section:

Code: Select all

[MeasureSite]
Measure=Plugin
Plugin=WebParser
URL=https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE
RegExp=(?siU)price":(.*)
UpdateRate=100
Not sure what RegExp=(?siU) should be.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Parsing dogecoin price

Post by ikarus1969 »

TimmyT1983 wrote: February 1st, 2021, 10:26 am hey, just trying to get the "price" from this:
https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE

which is:

Code: Select all

{"timestamp":"2021-02-01T10:30:01.673Z","error":false,"status":200,"message":"OK","data":{"currency":{"DOGE":{"name":"Dogecoin","slug":"dogecoin","iso":"DOGE","circulatingSupply":128061945503.677,"priceInBTC":0.0000011635204137922225,"quotes":{"USD":{"iso":"USD","name":"United States Dollar","slug":"united-states-dollar","change24Hr":{"percent":44.63260491878737,"value":0.0123477129},"price":0.040012943,"volume24Hr":64577526593.7326,"marketCap":5124135326.30645,"open":0.0276652301,"low":0.0271708115,"high":0.0491709685,"close":0.040012943}}}}}}
...

Not sure what RegExp=(?siU) should be.
Just use that for example:

Code: Select all

[MeasureSite]
Measure=Plugin
Plugin=WebParser
URL=https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE
RegExp=(?siU)price":(.*),
StringIndex=1
UpdateRate=100

RegExp=(?siU)price":(.*), means:
look for the string after price: until a comma (not included)

the (?siU) describe some options for the regular-expression. Here:
s -> look at the text from the url as a single line
i -> ignore case
U -> capture in ungreedy mode
TimmyT1983
Posts: 12
Joined: December 22nd, 2020, 10:39 pm

Re: Parsing dogecoin price

Post by TimmyT1983 »

I added the comma and not getting any price.

This is just a hacked up webparser ini tutorial i'm experimenting with but:

Code: Select all

Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=WebParserTutorial
Author=The Rainmeter Team
Information=Tutorial skin for the WebParser plugin
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=Oct 12, 2017

[MeasureSite]
Measure=Plugin
Plugin=WebParser
URL=https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE
RegExp=(?siU)price":(.*),
UpdateRate=100

[MeasureIP]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSite]
StringIndex=1

[MeterBackground]
Meter=Image
W=320
H=203
SolidColor=20,20,20,255

[MeterIPLabel]
Meter=String
X=160
Y=5
W=300
H=15
FontSize=11
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
StringAlign=Center
AntiAlias=1
Text=DOGECOIN PRICE

[MeterIP]
Meter=String
MeasureName=MeasureIP
X=160
Y=3R
W=300
H=15
FontSize=11
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
StringAlign=Center
AntiAlias=1
Last edited by TimmyT1983 on February 1st, 2021, 10:57 am, edited 1 time in total.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Parsing dogecoin price

Post by ikarus1969 »

Looks good for me. With your code i get:
SS RM.jpg
Edit: Just add a [ at the very beginning (at the Rainmeter section) - but it works without it (because of the defaults)
You do not have the required permissions to view the files attached to this post.
Last edited by ikarus1969 on February 1st, 2021, 10:59 am, edited 1 time in total.
TimmyT1983
Posts: 12
Joined: December 22nd, 2020, 10:39 pm

Re: Parsing dogecoin price

Post by TimmyT1983 »

That's odd. I wonder if it matters which version of rainmeter I'm using? Not sure what could be different. I'm getting a "(Fetch error) An error occurred in the secure channel support (ErrorCode=12157) (WebParserTutorial\WebParserTutorial.ini - [MeasureSite])"
Last edited by TimmyT1983 on February 1st, 2021, 11:00 am, edited 1 time in total.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Parsing dogecoin price

Post by ikarus1969 »

I'm just using the latest beta of rainmeter - which i recommend to anyone if asked (or not like here).
So if you don't mind, just download it (the latest beta) and try again.
TimmyT1983
Posts: 12
Joined: December 22nd, 2020, 10:39 pm

Re: Parsing dogecoin price

Post by TimmyT1983 »

I figured it out, internet explorer needed ssl unticked and tls ticked on. it works great, thanks again!

BTW for anyone else that wants to use this just replace DOGE (at the end of https://production.api.coindesk.com/v1/currency/ticker?currencies=DOGE ) with:

ADA,BCH,BSV,BTC,BTG,DASH,DCR,DOGE,EOS,ETC,ETH,IOTA,LSK,LTC,NEO,QTUM,TRX,XEM,XLM,XMR,XRP,ZEC

to get whatever crypto prices you need