Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3281772
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:51:11+00:00 2026-05-17T19:51:11+00:00

you guys ever saw that FB scrapes the link you post on facebook (status,

  • 0

you guys ever saw that FB scrapes the link you post on facebook (status, message etc.) live right after you paste it in the link field and displays various metadata, a thumb of the image, various images from the a page link or a video thumb from a video related link (like youtube).

any ideas how one would copy this function? i’m thinking about a couple gearman workers or even better just javascript that does a xhr requests and parses the content based on regex’s or something similar… any ideas? any links? did someone already tried to do the same and wrapped it in a nice class? anything? 🙂

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:51:11+00:00Added an answer on May 17, 2026 at 7:51 pm

    FB scrapes the meta tags from the HTML.

    I.e. when you enter a URL, FB displays the page title, followed by the URL (truncated), and then the contents of the <meta name=”description”> element.

    As for the selection of thumbnails, I think maybe FB chooses only those that exceed certain dimensions, i.e. skipping over button graphics, 1px spacers, etc.

    Edit: I don’t know exactly what you’re looking for, but here’s a function in PHP for scraping the relevant data from pages.
    This uses the simple HTML DOM library from http://simplehtmldom.sourceforge.net/

    I’ve had a look at how FB does it, and it looks like the scraping is done at server side.

    
        class ScrapedInfo
        {
            public $url;
            public $title;
            public $description;
            public $imageUrls;
        }
    
        function scrapeUrl($url)
        {
            $info = new ScrapedInfo();
            $info->url = $url;
            $html = file_get_html($info->url);
    
            //Grab the page title
            $info->title = trim($html->find('title', 0)->plaintext);
    
            //Grab the page description
            foreach($html->find('meta') as $meta)
                    if ($meta->name == "description")
                            $info->description = trim($meta->content);
    
            //Grab the image URLs
            $imgArr = array();
            foreach($html->find('img') as $element)
            {
                    $rawUrl = $element->src;
    
                    //Turn any relative Urls into absolutes
                    if (substr($rawUrl,0,4)!="http")
                            $imgArr[] = $url.$rawUrl;
                    else
                            $imgArr[] = $rawUrl;
            }
            $info->imageUrls = $imgArr;
    
            return $info;
        }
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well after getting all the help I could ever hope for, from you guys
Guys, what is function called after my class loaded, where i can call self
guys please post me an example for threading in MFC....it should show the progress
Hello guys i have been using JavaFx scene builder to build a gui that
I have a facebook app which runs in an iframe. When ever a new
Has any of you guys ever tried writing a 2d game in C++ using
Guys, does anybody ever try to print messages on your invoices using language other
First of all I want to link you guys to the JSFiddle I've made
I am not ever sure this is possible but I know you guys will
Guys I am a programmer and when I need to add something that looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.