Jump to content
UBot Underground

Hard time scraping FB likes


Recommended Posts

I am trying to build a bot that scrapes the page links and like count from the Facebook search page. For example: https://www.facebook.com/search/str/campus%20crusade/pages-named

 

I have been successful in scraping the links but the likes count is just not working. The bot is missing a large number of the like counts and I just do not know why. The selector correctly tells me that there should be 12 scrapes per page, but when I run the bot I get significantly less.

 

My code below:

ui stat monitor("Page Links", %FB Page Links)
ui stat monitor("Likes", %likes)
clear list(%likes)
clear list(%FB Page Links)
clear list(%Search URLs)
clear list(%FB Page Links FINAL)
add list to list(%Search URLs, $list from file("C:\\Users\\Jonathan\\Dropbox\\Ubot Files\\FB Page Link Scraper\\searchurls.txt"), "Delete", "Global")
loop($list total(%Search URLs)) {
    navigate($next list item(%Search URLs), "Wait")
    loop(2) {
        run javascript("window.scrollTo(0,document.body.scrollHeight); ")
        wait(3)
    }
    wait for browser event("Everything Loaded", "")
    add item to list(%FB Page Links, $scrape attribute(<outerhtml=w"<div class=\"_zs fwb\" data-bt=\"\{"ct":"title"\}\"><a href=*</a></div>">, "innerhtml"), "Delete", "Global")
    add item to list(%likes, $scrape attribute(<outerhtml=w"<div class=\"_52eh\">* like this</div>">, "innertext"), "Delete", "Global")
    set(#Page Links, $find regular expression(%FB Page Links, "(?<=<a href=\\\").*(?=\\\">)"), "Global")
    add list to list(%FB Page Links FINAL, $list from text(#Page Links, $new line), "Delete", "Global")
}

 

Please help!

Edited by jonchiehlau
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...