It is currently May 2nd, 2024, 4:27 am
Get help with creating, editing & fixing problems with skins
wiedzmawiedzma
Posts: 112 Joined: August 18th, 2012, 5:19 pm
Post
by wiedzmawiedzma » September 12th, 2012, 5:46 pm
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.
MerlinTheRed
Rainmeter Sage
Posts: 889 Joined: September 6th, 2011, 6:34 am
Post
by MerlinTheRed » September 12th, 2012, 5:53 pm
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.
thatsIch
Posts: 446 Joined: August 7th, 2012, 9:18 pm
Post
by thatsIch » September 12th, 2012, 6:50 pm
maybe it would be easier to just parse the name of the photographer
and write "Photograph by" in front of it
KreAch3R
Posts: 608 Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR
Post
by KreAch3R » September 12th, 2012, 7:09 pm
+1. Static text is static.
MerlinTheRed
Rainmeter Sage
Posts: 889 Joined: September 6th, 2011, 6:34 am
Post
by MerlinTheRed » September 12th, 2012, 7:15 pm
We don't know if it's static
KreAch3R
Posts: 608 Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR
Post
by KreAch3R » September 12th, 2012, 8:15 pm
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.
wiedzmawiedzma
Posts: 112 Joined: August 18th, 2012, 5:19 pm
Post
by wiedzmawiedzma » September 17th, 2012, 5:42 pm
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] ?
Kaelri
Developer
Posts: 1721 Joined: July 25th, 2009, 4:47 am
Post
by Kaelri » September 17th, 2012, 6:57 pm
No, sorry. If you are downloading multiple files, you need a separate WebParser measure for each one.