Jump to content
UBot Underground

Scraping a Specific Value on Facebook Pages


Recommended Posts

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

Link to post
Share on other sites

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...

Link to post
Share on other sites

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.

Link to post
Share on other sites

Managed to get it to replace the Photos word but not the "Wall Photos"

So when I look at the list item it's called

Wall Photos

4

 

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")

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...