It is currently May 2nd, 2024, 4:27 am

WebParser?

Get help with creating, editing & fixing problems with skins
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

WebParser?

Post by wiedzmawiedzma »

When reading author photo, I used :

Code: Select all

RegExp ="(?siU)<p class="credit">(.*)</p>"
I read is as follows:
Photograph by <a href="http://ngm.nationalgeographic.com/myshot/gallery/402189">Paul Coleman</a>, My Shot
Selected items, I would like to get rid of to make it look like this:
Photograph by Paul Coleman

And here the question of how it should look like RegExp =
to exclude selected items?
The screenshot below shows the code for my question.
You do not have the required permissions to view the files attached to this post.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: WebParser?

Post by MerlinTheRed »

You need to puzzle this together from multiple StringIndexes. You can't "delete" something in the middle of a capture group with regexes. It's not that hard though:

RegExp="(?siU)<p class=\"credit\">(.*)<a.*>(.*)</a>"

Then you can access "Photograph by" with StringIndex=1 and "Paul Coleman" with StringIndex=2.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: WebParser?

Post by thatsIch »

maybe it would be easier to just parse the name of the photographer
and write "Photograph by" in front of it
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: WebParser?

Post by KreAch3R »

+1. Static text is static.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: WebParser?

Post by MerlinTheRed »

We don't know if it's static ;)
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: WebParser?

Post by KreAch3R »

MerlinTheRed wrote:We don't know if it's static ;)
I was assuming he was always parsing photographs. Otherwise you 're right, your approach is solid-proof. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: WebParser?

Post by wiedzmawiedzma »

I have a question, or if you use a few web addresses to download the "Photo of the Day" is a must read:

Code: Select all

[Variables]
ImagePath=#CURRENTPATH#DownloadFile\
SubFolders=0
FileFilter=*.jpg;*.jpeg;*.png;
Bing=http://www.bing.com/
NationalGeographic=http://photography.nationalgeographic.com/photography/photo-of-the-day/
Kodak=http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=38/2549&pq-locale=en_US
Smithsonian=http://www.smithsonianmag.com/arts-culture/photo-of-the-day/
UpdateRate = 3600

[MeasureWebParserBing]
Measure=Plugin
Plugin=WebParser
UpdateRate = #UpdateRate#
Url=#Bing#
RegExp = "g_img={url:'(.+?)'"
StringIndex=1
DecodeCharacterReference=1
Download=1
DownloadFile=1.jpg
FinishAction=!Redraw

[MeasureWebParserNationalGeographic]
Measure=Plugin
Plugin=WebParser
UpdateRate = #UpdateRate#
Url=#NationalGeographic#
RegExp ="(?siU)<img src=\"(http://images\.nationalgeographic\.com/wpf/media-live/photos/.*)\".*<h2>(.*)</h2>.*<p class=\"credit\">(.*)<a.*>(.*)</a>"
StringIndex=1
DecodeCharacterReference=1
Download=1
DownloadFile=2.jpg
FinishAction=!Redraw

[MeasureWebParserKodak]
Measure=Plugin
Plugin=WebParser
UpdateRate = #UpdateRate#
Url=#Kodak#
RegExp ="(?siU)var imageurl = "(.*)""
StringIndex=1
DecodeCharacterReference=1
Substitute="/global/mul/potd/":"http://www.kodak.com/global/mul/potd/"
Download=1
DownloadFile=3.jpg
FinishAction=!Redraw

[MeasureWebParserSmithsonian]
Measure=Plugin
Plugin=WebParser
UpdateRate = #UpdateRate#
Url=#Smithsonian#
RegExp ="(?siU)"photo-img"><img src="(.*)""
StringIndex=1
DecodeCharacterReference=1
Download=1
DownloadFile=4.jpg
FinishAction=!Redraw
Is it possible to use all in one [MeasureWebParser] ?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: WebParser?

Post by Kaelri »

No, sorry. If you are downloading multiple files, you need a separate WebParser measure for each one.