How to get post notifications from Facebook page you follow - python

I am trying to make a python script that queries post notifications from a page I am following on Facebook using Graph API. However, it seems that Facebook made it more restrictive after the Cambridge Analytica scandal, even if you get it from your own account. What is the legal and working way to either query posts or notifications from a public page?

You’d have to start by submitting your app for Page Public Content Access, if you want to get public posts.
For the verification as an individual developer, see https://developers.facebook.com/docs/apps/review#individual-verification
Notifications however are only accessible, if you have admin access to the page.

Related

Get permalink when a Facebook page starts a live stream?

I'm trying to automate getting notified of a Facebook live stream by a public page, and also it's permalink.
Based on answers to this question, I would need to submit an App Review to Facebook to access the required permission to use Facebook's API in order to get the permalink to the live stream.
Because I'm writing this app just for my own use, I'm trying to avoid all the complicated steps to submit for an App Review. Is there any other way to get notified when a Facebook page starts a live stream and get the permalink to the live stream other than for example, scraping the Facebook page with selenium?
This is not possible via Facebook API's because /{page_id}/live_videos is only accessible if you are an admin of the page or have been granted access per the linked post.

Scraping Instagram for contact email addresses

I'm new to the stackoverflow community but working on a scraping project for instagram (i'm not super technical). I want to start with 10 or 20 targeted accounts and scrape their contact email off their "contact" button if it's there. Then look at all of their "recommend accounts" to follow associated and do the same thing. Basically, trying to automate and aggregate collecting targeted email addresses from the "Contact" button on Instagram accounts in my niche.
Welcome to Stack Overflow.
I want to start with 10 or 20 targeted accounts and scrap their contact email off their "contact" button if it's there. Then look at all of their "recommend accounts" to follow associated and do the same thing. Basically, trying to automate and aggregate collecting targeted email addresses from the "Contact" button on Instagram accounts in my niche.
You're not the only one working on this... I recommend starting off by reading Instagram's API documentation. You will not want to try to scraping Instagram, the website changes to frequently - IMO. You need to get API access. There are some hurdles to doing that, namely:
You need to build you application in Sandbox Mode which means you only have access to a very limited view.
You need to demo your application in a video. This is required for submission.
The video screencast must show the Instagram login experience of your app, proper credentials and the usage of every permission you are requesting. We will not approve submissions if you do not provide a clear and working screencast.
You have to submit an application, and they are strict.
Your application will need to address one of three use cases:
To help individuals share their own content with 3rd party apps
To help brands and advertisers understand and manage their audience and
digital media rights
To help broadcasters and publishers discover
content, get digital rights to media, and share media with proper
attribution
Good luck! DM me if you need more help. There is a feature in influencer marketing analytics software, PromoPlanner that I use to find influencers.

Publishing videos to Facebook Page as Page - publish_stream and manage_pages permissions not working

Attempting to write a simple server-side Python script that posts videos to a Facebook page (not a personal page, but a sports team page that I have admin permissions for). The script works perfectly when uploading videos to my own personal FB page, and other FB pages that I created — but I keep getting this error:
OAuthError: [200] (#200) Subject does not have permission to post videos on this page
When attempting to post videos with the script to a page that I do have admin permission for, but I didn't create (pointing that out because it's a consistent difference in the oauth response I keep seeing, assuming maybe page creation has something to do with this?).
I have tried using facepy, which is a great Python library for Facebook, but so far no luck in resolving this issue.
I know that responses to questions related to this topic from a few years ago mention that:
To publish to Page as User you need publish_stream permission granted
by User.
To publish to Page as Page you need publish_stream and manage_pages
permissions granted by User and Page access_token which can be
retrieved from accounts connection of user.
But when creating a token for my app using Facebook's Graph API Explorer, all of these permission are enabled/checked off, every single one, but still the same permissions error.
Has anyone seen anything like this?
Solution to this is here:
facebook: permanent Page Access Token?
For anyone trying to develop a strictly server-side app for automated video uploads via cron job to a page, carefully follow the steps outlined by donut's answer in the linked post.
You need add this permission publish_actions in https://developers.facebook.com/apps/ in status and review items.

How to add facebook login to Python Django Project?

I want to build a Django application where I have a simple button "login using Facebook" and it redirects you to the Facebook page allowing to log in with facebook username and password . When user clicks "login" . It should redirect me to my already defined url where i can display the user's public information from his profile. How this can be achieved ??
Just like 4shared.com allows to login with Facebook . I want something like that but i only want to display its public information of the user.
You should take a look at some of the existing OAuth libraries for django. I'm using allauth, and I can definitely recommend it, even though the documentation is a bit lacking.
Here's a tutorial that helped me a lot when I was starting out:
http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/
As to how to display the Facebook user's public information, you should consult the Facebook Graph API

Cross-domain Ajax POST and user verification

I'm working on app which saves things from many cross domains via Ajax POST method to my server/app. I need to find a solution how to send a POST and verify if the user who sent it is already signed on my site and than save it to the database.
I am pretty sure that I need Chrome, Firefox extension to do it, because I need to embed my js on every page my users surf on. The thing is I don't know where to start and how should it work. I could set up proxy to make JSON POST work, but I don't know how to verify if the user is signed on my site.
Should I get cookies of my users from browser via Chrome API and sent it in the POST and authenticate the cookie/session in Django? What do you suggest?
Thank you for your help. I appreciate every hint.
When the user logons at http://yourserver.com, you can set a permanent cookie to identify him. (see SESSION_EXPIRE_AT_BROWSER_CLOSE and COOKIE_AGE variables in django)
Then, when he embeds any JS from another site from yourserver.com domain, the cookies are automatically sent for this domain, and you can check on your django side for the cookie existence and validity and give the good JS.
Because of crossdomain issues, you should better use form POST as an alternative as AJAX as it is not security restricted. You can then play with iframes and javascript to make both domains communicates.
To embed the JS in another website, you can use a browser extension, or a simple bookmarklet, which will load your code in the current page when the user clicks it from any webpage.
My 2 cents;

Categories