Hi,
This my WebParser worked for years and then suddenly stopped. I noticed difference in the URL from http:// to https://, I have corrected and not resolved. The image is not downloaded.
It works for other URLs but not for this.
[MSMoonPic]
Measure=Plugin
Plugin=WebParser
UpdateRate=#UpdateMoon#
; Url="https://static.die.net/moon/512.jpg"
Url="https://static.die.net/moon/800.jpg"
; 512 -> Image size
Download=1
DownloadFile="Moon.jpg"
Anyone know what happened and how to solve it?
It is currently April 24th, 2024, 6:12 am
Why WebParser Download Stops Working?
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
Not sure. They may have built-in a browser check to prevent this kind of automatic downloading from the site.
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
Re: Why WebParser Download Stops Working?
Is there any chance of getting our beautiful picture?
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
I think you are going to have to use Powershell, with a script something like this:
Lemmie chew on how best to implement that.
I think the issue is that the site has implemented CloudFlare, which is doing a "browser check" and then re-directing you to the image. WebParser can't deal with re-directs.
Code: Select all
$url = "https://static.die.net/moon/800.jpg"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, "C:\temp\test.jpg")
I think the issue is that the site has implemented CloudFlare, which is doing a "browser check" and then re-directing you to the image. WebParser can't deal with re-directs.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
So like this:
Skin:
GetMoon.ps1:
That will fire it when the skin is loaded or refreshed, and every subsequent 10 minutes... 600 X 1000 milliseconds.
Geeky note: The reason for the [!SetOption MeterShowMoon ImageName "Moon.jpg"] on the FinishAction option is to address a timing issue. The Powershell script is executed when the skin is first loaded, and appears to have time to create an empty "moon.jpg" file in the folder before it is done downloading the actual image. If you have ImageName set on the Image meter to start with, it will find and load that empty image, and "cache" it in memory. It will never load the completed one then. Setting ImageName only after the Powershell is entirely completed solves this issue, as the image meter isn't looking for the image until it it done.
Skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
URL=https://static.die.net/moon/800.jpg
[MeasureScheduleDownload]
Measure=Calc
UpdateDivider=600
OnUpdateAction=[!CommandMeasure MeasureRun "Run"]
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Program=PowerShell.exe
Parameter=-NoProfile -ExecutionPolicy Bypass -Command "& '.\GetMoon.ps1' '#URL#' '.\Moon.jpg'"
FinishAction=[!SetOption MeterShowMoon ImageName "Moon.jpg"][!UpdateMeter MeterShowMoon][!Redraw]
[MeterShowMoon]
Meter=Image
Path=#CURRENTPATH#
W=200
PreserveAspectRatio=1
Code: Select all
$url = $args[0]
$file = $args[1]
Remove-Item $file
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $file)
That will fire it when the skin is loaded or refreshed, and every subsequent 10 minutes... 600 X 1000 milliseconds.
Geeky note: The reason for the [!SetOption MeterShowMoon ImageName "Moon.jpg"] on the FinishAction option is to address a timing issue. The Powershell script is executed when the skin is first loaded, and appears to have time to create an empty "moon.jpg" file in the folder before it is done downloading the actual image. If you have ImageName set on the Image meter to start with, it will find and load that empty image, and "cache" it in memory. It will never load the completed one then. Setting ImageName only after the Powershell is entirely completed solves this issue, as the image meter isn't looking for the image until it it done.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 75
- Joined: December 15th, 2018, 3:35 am
Re: Why WebParser Download Stops Working?
Ok!
Now I have work ahead, I will test at the earliest opportunity and then return the results!
Many thanks for now.
Now I have work ahead, I will test at the earliest opportunity and then return the results!
Many thanks for now.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
Sure. Let me know if you have questions.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
And if you use the latest 4.3 beta of Rainmeter, you can use Container to remove the black background on the image. Cause, why not...
https://docs.rainmeter.net/manual-beta/meters/general-options/container/
https://docs.rainmeter.net/manual-beta/meters/general-options/container/
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
URL=https://static.die.net/moon/800.jpg
[MeasureScheduleDownload]
Measure=Calc
UpdateDivider=600
OnUpdateAction=[!CommandMeasure MeasureRun "Run"]
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Program=PowerShell.exe
Parameter=-NoProfile -ExecutionPolicy Bypass -Command "& '.\GetMoon.ps1' '#URL#' '.\Moon.jpg'"
FinishAction=[!SetOption MeterShowMoon ImageName "Moon.jpg"][!UpdateMeter MeterShowMoon][!Redraw]
[MeterContainer]
Meter=Shape
Shape=Ellipse 100,100,96 | StrokeWidth 0
[MeterShowMoon]
Meter=Image
Path=#CURRENTPATH#
W=200
PreserveAspectRatio=1
Container=MeterContainer
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Why WebParser Download Stops Working?
Probably you're right. But if you do, how does work the later posted PowerShell code? Is it "deceives" somehow the URL?
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Why WebParser Download Stops Working?
I think in any case the browser-check is passed, but there is then a re-direct to the actual image. WebParser, or I think more to the point, the Download function of WebParser, just can't deal with a re-direct like that, where the Powershell function seems to be able to. I think the key to that is the C#-based System.Net.WebClient, which is likely a slightly more robust animal than the C++ WinINet API calls used in WebParser.