Kev 69 Posted October 5, 2012 Report Share Posted October 5, 2012 Hi all,I'm working through a fb project and need to scrape a URL ONLY if it's value is greater than a variable, for example 10. I have a list of URLS that are to Facebook pages photos, like this one (Internet Explorer 6 for the user agent) What I need to do though is ONLY scrape the Wall Photos link ONLY if the number of photos under it is greater than, say 10. What I am only able to do is scrape the url (that part is fine) but I would only want the URLs scraped if they are above a certain value. How can I do this? http://content.screencast.com/users/koconnor00/folders/Jing/media/93150e57-ac88-4eea-afaa-283641a90328/2012-10-05_2026.png Thanks a million, Kevin Quote Link to post Share on other sites
Legend 181 Posted October 5, 2012 Report Share Posted October 5, 2012 Are you able to scrape the part that says "6 photos"? If so, you can just do a replace and get rid of the "photo" or "photos", then you are left with a number. Then a simple if -> comparison -> # > 10 should do it if I'm understanding this correctly... Quote Link to post Share on other sites
Kev 69 Posted October 5, 2012 Author Report Share Posted October 5, 2012 Hi Duane, Yeah I can scrape the 6 photos, however it scrapes the other photo counts too, so I'm not able to specifically scrape the photo count for Wall Photos unfortunately. Quote Link to post Share on other sites
Kev 69 Posted October 5, 2012 Author Report Share Posted October 5, 2012 Managed to get it to replace the Photos word but not the "Wall Photos"So when I look at the list item it's calledWall Photos4 So, I got rid of Photos but not the Wall Photos words.Here's the code I used:add item to list(%wallphotocount, $replace($scrape attribute(<outerhtml=w"<div class=\"photoText\"><a class=\"photoTextTitle\" href=\"http://www.facebook.com/*\"><strong>Wall Photos</strong></a><div class=\"photoTextSubtitle fsm fwn fcg\">*</div></div>">, "innertext"), "photos", $nothing), "Delete", "Global") Quote Link to post Share on other sites
k1lv9h 76 Posted October 6, 2012 Report Share Posted October 6, 2012 Hi, This will select only the album with "Wall Photo*" and add album url to list when picture count is 6 and over. Sample code:set user agent("Internet Explorer 6") set(#fburl, "http://www.facebook.com/pages/Fusion-Sushi-Manhattan-Beach/115644541843415?sk=photos", "Global") set(#fbselectalbumwith, 6, "Global") navigate(#fburl, "Wait") wait for browser event("Everything Loaded", 30) clear list(%photoalbumsscrape) add list to list(%photoalbumsscrape, $scrape attribute(<outerhtml=w"<td class=\"vTop hLeft *\">*<strong>Wall Photo*</strong>*<div class=\"photoTextSubtitle fsm fwn fcg\">* photo*</div>*</td>">, "outerhtml"), "Delete", "Global") clear list(%photoalbumurls) loop($list total(%photoalbumsscrape)) { if($comparison($list position(%photoalbumsscrape), "<", $list total(%photoalbumsscrape))) { then { set(#photoalbumscrapeitem, $next list item(%photoalbumsscrape), "Global") set(#photoalbumpiccount, $replace regular expression($replace regular expression(#photoalbumscrapeitem, ".*fcg\">", $nothing), ".photos<\\/div.*", $nothing), "Global") if($comparison(#photoalbumpiccount, ">=", #fbselectalbumwith)) { then { add item to list(%photoalbumurls, $replace regular expression($replace regular expression(#photoalbumscrapeitem, ".*href=\"", $nothing), "\"><strong>.*", $nothing), "Delete", "Global") } else { } } } else { } } } sample-facebook-images-006.ubot I change the other program I had provided first. The reread what you wanted. I chopped it down to this. Kevin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.