embedding videos loaded on box - python

So basically we would like to integrate our platform with box.net, in particular to be able to stream videos uploaded there, since we can't unfortunately use youtube/vimeo (which support noembed).
I had a look in the doc and:
it seems that for videos the preview is only working for flv and swf.
However I tried with my personal account and one swf embedded with their embedding link didn't preview anyway.
I would like to use the API to upload videos directly from the client, but what happens if the user is not actually authenticated to box.net and the video is private (which is our requirement).
If embedding videos with box is just not going to work we can look at other alternatives, but unfortunately from the list of supported sites http://noembed.com/
it doesn't that we could use any of the services..

For the second point, you can just do all the authentication for your site via box.net. They provide authentication as part of their api: http://developers.box.com/oauth/.
When a user logs into your site, authenticate them with box.net using python requests, and a custom authentication backend, django docs here, example on stack overflow here: Django Remote Authentication without redirecting.

Related

using Python and the Twitter API without authentication tokens

I would like to create a tool with Python and the Twitter API to be able to create lists of tweets that match certain criteria like "contains the word Python" or "has at least 2 likes". Or simple stats like top posters, most liked, etc.
All of my search pointed me to the Tweepy project. But for that I need 0Auth tokens. So I applied for a developer account and was denied with the comment "we are unable to serve your use case".
Do I have any alternatives?
Well, as a general answer for these situations, you can always use a web-based automation tool, which is basically a library that interacts with the remote feature of the browsers and replicates what would be you "opening the website, logging in, etc" and can subsequently parse all data from the rendered elements.
Try looking at selenium, i've used that library in the past to raw scrap facebook and it worked flawless.
Edit: Note that this isn't a twitter specific library, you will have to find the html tags in the login website and use them to log in, same for parsing data, etc.

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 do I send myself a message on Facebook using python?

It appears pyfacebook and simplefacebook are deprecated. So is the facebook e-mail service. What is the current way of accomplishing this?
https://developers.facebook.com/products/messenger/
There appears to be links to build apps integrating messenger support here.
You can try to utilize the APIs there, since several apps seem integrated using it, I assume it is unlikely to change drastically anytime soon.
Here is a link I found which demonstrates the API for how to send messages using facebook's send API https://developers.facebook.com/docs/sharing/reference/send-dialog The tutorial is for Javascript but you might be able to adapt it to work for Python as well.
Here's the build for an app called Facebook Autoresponder, you might be able to reverse engineer their process from looking at it : http://sourceforge.net/projects/facebook-autoresponder/files/?source=navbar

Realtime list of viewers in a Google Drive document

I'm working on an app which wraps Google Docs (using GAE/Python), and I want to keep track of who is viewing these docs in real-time. I can't find any APIs for this in the Google Drive SDK.
What's a good way to do this? Naively, I might imagine repeatedly polling each document individually and parsing the returned HTML. I expect there to be ~150 docs total in the system; would this be too inefficient?
Realtime api is not for using with gdocs, only for your own custom formats. Instead see the changes api in drive but you wont be able to detect viewers only modifications https://developers.google.com/drive/manage-changes
I am not sure if this meets your requirement but there is a Realtime API available in the Drive SDK.
The catch is that it is JavaScript only. It does have Events that your web client can be notified off like CollaboratorJoinedEvent and CollaboratorLeftEvent.

Programmatic login and use of non-api-supported Google services

Google provides APIs for a number of their services and bindings for several languages. However, not everything is supported. So this question comes from my incomplete understanding of things like wget, curl, and the various web programming libraries.
How can I authenticate programmatically to Google?
Is it possible to leverage the existing APIs to gain access to the unsupported parts of Google?
Once I have authenticated, how do I use that to access my restricted pages? It seems like the API could be used do the login and get a token, but I don't understand what I'm supposed to do next to fetch a restricted webpage.
Specifically, I am playing around with Android and want to write a script to grab my app usage stats from the Android Market once or twice a day so I can make pretty charts. My most likely target is python, but code in any language illustrating non-API use of Google's services would be helpful. Thanks folks.
You can get the auth tokens by authenticating a particular service against https://www.google.com/accounts/ClientLogin
E.g.
curl -d "Email=youremail" -d "Passwd=yourpassword" -d "service=blogger" "https://www.google.com/accounts/ClientLogin"
Then you can just pass the auth tokens and cookies along when accessing the service. You can use firebug or temper data firefox plugin to find out the parameter names etc.
You can use something like mechanize, or even urllib to achieve this sort of thing. As a tutorial, you can check out my article here about programmatically submitting a form .
Once you authenticate, you can use the cookie to access restricted pages.
CLientLogin is now deprecated: https://developers.google.com/accounts/docs/AuthForInstalledApps
How can we authenticate programmatically to Google with OAuth2?
I can't find an expample of request with user and password parameter as in the CLientLogin :(
is there a solution?

Categories