I want to upload video to Youtube from my ASP.NET application. It should return video ID or embed code after uploaded video.
Ah, google integration. Be ye warned: here lies madness.
http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Process_Flows_for_Uploading_Videos
An extremely high overview:
You will either
Need to perform integration with oauth to retrieve an authorization token, or
Pass this user along to google to authorize them and then send you back a token which you must catch.
After authorization you may either:
Send youtube an http post request containing the video upload as well as meta data, or
Submit a form post that contains the a hidden input feild with their auth token.
Youtube then passes you back data that contains the id as well as other meta video data.
At this point you would need to perform additional http posts to their api in order to retrieve the embed code.
Youtube's api upload documentation lists between 6-13 steps depending on what choices you make in your app.
Hope this overview helps!
Edit
Here is another question on SO about this same thing. It includes code samples:
How can I upload a video to YouYube using the Youtube API in C#?
Related
I have a wordpress website that uses woocommerce memberships.
We somehow managed to map patreon users to woocommerce memberships so that they get all the perks via our own website.
I know it's possible to query the Youtube API endpoint members.list which would give us 1) the membership level and
2) the youtube channel id of each individual member
How can we then validate that a wordpress user is a youtube valid member?
With patreon the validation is by matching email address, but on youtube there's no access to the user email. I guess the user would have to set his youtube channel id in our website so we can later confirm it matches a valid membership.
The problem is that anyone can provide someone elses channel id to trick the system...
any ideas that would help with this much appreciated
If I were you I would generate a token for each user on your website, such that if they put this token in their channel description (ABOUT tab) then you can be sure that the given YouTube channel owns the given account on your website where he got his random token. You can get their channel description by using this reverse-engineered YouTube UI solution.
You can also think of other mechanisms such as requiring the user to post a comment on a video and checking using YouTube Data API v3 CommentThreads: list endpoint or post a message on a livestream and checking using YouTube Live Streaming API LiveChatMessages: list endpoint.
Note that depending on your token format, it may be useful to use an unusual pattern to put in their channel descriptions to avoid wrong authentication (a channel description containing unintentionally a token assigned to a user by your website). For instance if you assign an id (0, 1 and so on) to each user (or if you just use their usernames) just requiring this id to be in the channel description isn't very secure as anyone may put unintentionally someone else token. What you can do while still avoiding random token is to use a prefix. That way your website won't just look for 0, 1 and so on in their channel description but instead Your website: 0 or Your website: 1... Using a prefix keeps user-friendliness (Your website: Benjamin Loison looks better than 77ff716cfdd4e7ed) while being quite secure.
I want to use google forms to collect questionnaire responses but with a much more custom UI for doing so. Is there a way to send in responses from my custom application to my google forms api?
You can use the endpoint to fill the google form directly.
Steps -:
Create a google sheet.
Click on the Tool menu to create a google form.
Then create some google forms fields.
Now in the right top corner click on the 3 dots and select the Pre-fields link form.
Fill the info and click on the Get link and copy the link
Now you have a URL with the endpoints like this
Endpoints are
entry.1651815625.
entry.952362665
Google Sheet Link for Form -: "https://docs.google.com/forms/d/e/1FAIpQLSfxoz5dqXC-_LoGJWZCPasww6woHcOl0s48PYcCj-72uUJoBQ/viewform?usp=pp_url&entry.1651815625=Radha&entry.952362665=Krishna"
To Convert this link to this way
"https://docs.google.com/forms/d/e/1FAIpQLSfssz5dqXC-_LoGJWZCP93ww6woHcOl0s48PYcCj-72uUJoBQ/formResponse?&submit=Submit?usp=pp_url&entry.1651815625=Radha&entry.952362665=Krishna"
Instead of "viewform" you have to write "formResponse?&submit=Submit"
Now you can pass your own value and hit this URL to submit your google form directly.
For more info, you can watch this video from The Coding Bus
https://youtu.be/PVM7h5QCnnM
If you want to update the form's layout, it is possible to update it from your application using the Google Forms API. However, the Google Forms API currently does not support sending responses to your form, as shown here
At this time the Google Forms REST API doesn't support creating form responses as the Form.responses resource only includes two methods: get and list. Ref. https://developers.google.com/forms/api/reference/rest/v1/forms.responses?hl=en
You might use the Forms Service from Google Apps Script to create Google Forms Responses programmatically. To call this service from your app you might create a web-app in order have a HTTP GET / POST request end-point or use the Google Apps Script REST API.
Another option might be to use a "hack" to emulate the Google Forms POST request. See Auto-Fill or automate a Google Form
Related
Is it possible to 'prefill' a google form using data from a google spreadsheet?
how to create a google form response with app script
Load form responses with script in sheet - Create initial forms with nothing but an ID number
I am sending an marketing Email attaching an image or PDF URL.
Is there is any way to track how may users viewed/clicked this page via google analytics ? I could see the number of page view who accessed html pages but seeking for a way to find how many of them accessed image or PDF URL?
Including a link directly to a pdf or image will simply open the resource without JavaScript tracking or cookies required for Google Analytics.
You would need to send a GA hit from your server in response to the request for those files - neither trivial nor recommended in this case
Rather send the link to a page on your site containing the content.
Tracking that in GA is trivial and is likely already set up on your site.
If you need to have the content in a PDF rather than on the web page directly, have a link to the PDF and track that as an event or Virtual Page View
I would also recommend tagging the link in your email with GA UTM Campaign Parameters to identify the traffic from that link
If your question is about tracking the email itself, please restate the question.
all I am trying to create Google Analytic clone. I know how to get information about the browser location IP and other similar things in PHP
What I want to know is how to create a java-script which sends this information from any website where my code is placed on my server ???
What is the minimum security requirement to create a tracking JavaScript code like google analytics?
redirect users to different pages based on session data in PHP?
Or in other words, do I have to send an ajax request to my server?
Is there any available solution already available subject to java-script?
Most analytics tools generate a url with query string parameters attached to it and then output a 1x1 image pixel, with the img src as the url. Your server would then receive and store the data. The only thing returned is the actual 1x1 pixel. This is the common method because in the event a site does not have js enabled, you wrap a hardcoded img to your server in noscript tags and still get basic info like page view.
But is there a reason why you are wanting to build your own analytics script instead of use an existing one? There are a number of 3rd party ones available, including free ones. Alternatively there is Piwik, which is a free and open source solution if you want to build off it and not have to start from scratch.
How can I send a message to the currently logged in user from inside a Flex application contained in a Facebook iFrame and using the official AS3 Library for Facebook please?
To date the Graph API is the easiest way to work with facebook.
http://code.google.com/p/fbas/
It's far from a complete implementation, but Graph is so simple it shouldn't take long to implement any features you need.
NOTE: When I've used it I ported the javascript portion of the example code on the project's main page to AS3 & ExternalInterface. It reduced external dependencies to zero (with the exception of swfobject)
Facebook does not allow you to send messages . Either way , you can post to the user's friends feed on behalf of the user , with a custom message and the the notification for the post in feed will be displayed.
Post your request to http://graph.facebook.com/PROFILE_ID/feed
Requires the publish_stream permission.
You can refer this link http://facebooksdk.blogspot.com/2011/04/facebook-album.html