Functionality: Chrome extension needs to recognize ads on Facebook feed (marked by word "Sponsored") and who posted the ad, text content of the add and links included in the ad (if there are any). The extension needs to send this information to a database together with the name of the viewer.
The code should correctly identify ads only. One suggested solution is to make calls to Facebook user API and check if a post’s title is included in the list of friends or subscriptions. These are surely not ads, so we could eliminate them. Perhaps you will find a better way to do it but that’s an idea that I had in mind. We also need Facebook API to find name of the person’s account (and send data to the database under the correct name). I presume that you will use long-lived access tokens to make API calls. Note that all people downloading the extension will log into our Facebook app on our survey page. We should obtain access token then (I will need code to insert on the survey page). Alternatively, you can obtain a person's name directly from the page.
“Paid for”: Some special ads (not all) include words “Paid for” as in the first image. Such ads should always be scraped even if their title is on subscriptions’ list. These should be flagged by if_paid_for = 1 when sent to the database.
Two version of Facebook: Finally, please note that Facebook has two versions: New and Classic (see the image below). Class names and node structure may be slightly different on Classic and we need to make sure that the extension works for both versions.