Get permalink when a Facebook page starts a live stream? - python

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.

Related

Retrieving Facebook Page comments with python script

I am building a python script that is trying to stream a screen capture to my Facebook Page and to be able to retrieve all the comments from the Facebook Live stream real time so that I can do some processing in the middle of the stream.
The Facebook App was set up (in development mode) but when I tried to retrieve the comments from my live stream, I am only able to retrieve comments with their name and id ("from") that are made as the Facebook Page Admin, not comments that are made by other users. I need the user's id, user's name and their comments.
I understand that I need to get Facebook App to be live mode in order to retrieve all the comments with their details tagged to it. When I tried to get it, it tells me that I need to get the permission approved. I tried to fill in most of the stuff and try to get the two permission (manage_page for the comments and live video API for the streaming) but I was unable to because I left the platform empty.
Below is the message I got:
You do not have any platforms eligible for review. Please configure a platform on your Settings page.
The problem is when I tried to choose a platform that was shown in the list, python script does not fall in the list of platform.
Does anyone know of a solution or a different way to achieve what I need to retrieve?
Have you tried using PyLivestream?
It can be used to stream to Facebook Live using FFmpeg (to multiple services simultaneously actually, like Periscope, YouTube etc).
It adheres to the RTMPS requirement and should be an option for you if I interpret your needs correctly.
python -m pip install PyLivestream
Facebook Live
Facebook Live requires FFmpeg >= 4.2 due to mandatory RTMPS
configure your Facebook Live stream
Put stream ID from https://www.facebook.com/live/create into the file facebook.key
Run Python script for Facebook with chosen input
Check out the PyPi PyLivestream page for details.
To be able to retrieve all the comments from the Facebook Live stream
I'm not sure if this is possible using PyLivestream alone, but the Polls API can be used to represent VideoPoll objects in the Graph API, to create polls on live video broadcasts and get real-time responses from your viewers and can be created with the
POST /{live-video-id}/polls
endpoint on a LiveVideo object.
Upon creation, the API will return a VideoPoll object ID, which you can use to manipulate the poll and query for viewer interactions.
Guess you'll have to do a bit of digging to figure out the details,
but I believe this would be the right way to approach this task.
In order to get the "from" field when retrieving the comments, you need to have manage_pages permission from your Facebook App that is linked to your Facebook Page. You will need to submit an App review for your Facebook App that usually takes 1-3 days to process. If you are lucky, it will probably take about 6-8 hours.
Once it is approved, you can request the permission and get your application to go live.
Also use the Page Access token in your "access_token" field when invoking the API so that it will allow you to pull the "from" field, which contains the id and name of the user.

How to login to shutterstock through python?

I have a Windows10 + Python3.7
Right now i using requests for download web content and analyse it. But i can change it to selenium or something else if it needed...
I Want to login to shutterstock website through python to get some information from user pages (my sales data and etc). Shutterstock don't have any API for this actions and for many actions too... I want to write a console script for collecting data only. I will saving data to CSV file
I can parse my page to find all what i'm interested, but before it i'm need to login. And here is a problem because site have a login page with google "I'm not a robot" widget.
I tried to use requests auth functions - but it's doesn't working.
This is a login page:
https://contributor-accounts.shutterstock.com/login
Site don't have any tokens and other auth items. I saw software who connect to shutterstock. It just show popup window with all of this items from login page and then starting work without any windows.
My questions:
How to login to shutterstock?
How to store session for a long time if it possible, because i want to run my script every 4 hours and don't want to see login window every time
Shutterstock is working on building out a contributor api that would allow contributors to programmatically fetch their earnings and downloads data. These specific endpoints are still in progress, plan is to get them out early next year. If you reach out to contributor support they can probably add you as a beta user for these (and other) features that you're looking for.

How to get post notifications from Facebook page you follow

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.

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 get details and facebook albums through django app in django-scoial-auth

I have followed the django-social-auth, i am able to login with facebook ID, but how to get the details,images that are stored in facebook into my django application using django-social-auth module.
Please read this first:
http://www.tryolabs.com/Blog/2012/02/13/get-user-data-using-django-social-auth/
And then read read graph API on facebook:
https://developers.facebook.com/docs/graph-api/
All I have done so far is get a mugshot, but this was how I started.

Categories