It is currently April 27th, 2024, 5:16 pm

Clock syncs from time.is

Get help with creating, editing & fixing problems with skins
User avatar
SilverAzide
Rainmeter Sage
Posts: 2613
Joined: March 23rd, 2015, 5:26 pm

Re: Clock syncs from time.is

Post by SilverAzide »

Yincognito wrote: January 11th, 2024, 10:43 pm Hmm... the code here still works for me, after adding the UserAgent suggested by balala (plus, I am able to CTRL+F the time in the page source, so it doesn't look to be hidden behind javascript... yet):
TimeIs.jpg
That being said, at the time I posted the code, Rube_Goldfish above got something different than I did too, so maybe the site provides slightly different results depending on user location... :confused:
Looks like some shenanigans going on... They're blocking Rainmeter, at least from the USA side. The UserAgent trick balala mentioned is working, tho the regexp needs tweaking. RainRegExp isn't working either.
Gadgets Wiki GitHub More Gadgets...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2613
Joined: March 23rd, 2015, 5:26 pm

Re: Clock syncs from time.is

Post by SilverAzide »

Code: Select all

PS> curl https://time.is/New_York
curl : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ curl https://time.is/New_York
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

PS> curl https://time.is/New_York -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.84'

StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
                    lang="en"><head><title>Time in New York, United States now - Time.is</title>
                    <link rel="preconnect" href="https://a.pub.network/...
RawContent        : HTTP/1.1 200 OK
....
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Clock syncs from time.is

Post by Yincognito »

SilverAzide wrote: January 11th, 2024, 10:53 pm Looks like some shenanigans going on... They're blocking Rainmeter, at least from the USA side. The UserAgent trick balala mentioned is working, tho the regexp needs tweaking. RainRegExp isn't working either.
SilverAzide wrote: January 11th, 2024, 10:59 pm

Code: Select all

PS> curl https://time.is/New_York
curl : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ curl https://time.is/New_York
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
 + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

PS> curl https://time.is/New_York -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.84'

StatusCode : 200
StatusDescription : OK
Content : <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
 lang="en"><head><title>Time in New York, United States now - Time.is</title>
 <link rel="preconnect" href="https://a.pub.network/...
RawContent : HTTP/1.1 200 OK
....
Well, that explains it. The site must really need an user agent to provide data, it seems. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth