YouTube API: video privacy option - youtube

How can I set a privacy option for the uploaded video? In the documentation I've found only http://code.google.com/intl/en-EN/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:private, but how can I mark video as "Unlisted"?

if you guys are doing this in PHP with Zend Gdata this is how its done:
// create a new video
$video = new Zend_Gdata_YouTube_VideoEntry();
$video->setVideoTitle('My Test Movie');
$video->setVideoDescription('My Test Movie');
$video->setVideoCategory('Animals');
$video->SetVideoTags('tag1, tag2');
// make video unlisted
$unlisted = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', '');
$unlisted->setExtensionAttributes(array(
array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'),
array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied')
));
$video->setExtensionElements(array($unlisted));

If you're not using any of the existing libraries (e.g., when implementing via Classic ASP), add the
<yt:accessControl action="list" permission="denied" />
in between the <entry></entry> pair. For example:
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">Video Title Here</media:title>
<media:description type="plain">Video Description Here</media:description>
<media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Person</media:category>
<media:keywords>Video Keywords Here</media:keywords>
</media:group>
<yt:accessControl action="list" permission="denied" />
</entry>
Reference: https://developers.google.com/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos

I don't have experience with this API, but it looks like
<yt:accessControl action='list' permission='denied'/>
is what you are after. This tag is mentioned on the same page that you linked to,
http://code.google.com/intl/en-EN/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl
Hope this helps, and please give some indication whether this suits your needs.

Related

openlayers 3 ol.format.WFS writeTransaction produces incorrect XML for simple UPDATE transaction

I have used the ol.format.WFS#writeTransaction method successfully to serialize the WFS-t XML for an insert operation to GeoServer, but when I attempt to do the same thing for an update operation the method produces an invalid WFS-t request. Is it possible that I am initializing the ol.format.WFS object incorrectly? Or maybe I am passing the wrong options to the writeTransaction method? Or maybe it's a bug in OpenLayers3?
Here is the gist of my Javascript:
var wfst = new ol.format.WFS({
featureNS: "mypoints",
featureType: "test_points"
});
var options = {
gmlOptions: {srsName: "EPSG:3857"},
featureNS: "mypoints",
featureType: "test_points"
};
var node = wfst.writeTransaction(null, [thePoint], null, options);
var shouldBeValidXML = new XMLSerializer().serializeToString(node)
Here's an example of the XML that that produces:
<Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Update typeName="feature:test_points" xmlns:feature="mypoints">
<Property>
<Name>geometry</Name>
<Value>
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857"><pos>-10606301.721251432 4226568.758428884</pos></Point>
</Value>
</Property>
<Filter xmlns="http://www.opengis.net/ogc">
<FeatureId fid="test_points.fid--62e21e8_153971e1869_-7ffe"/>
</Filter>
</Update>
</Transaction>
The issue is in line 2, where it says:
<Update typeName="feature:test_points" xmlns:feature="mypoints">
That makes GeoServer throw a NoApplicableCodeException, which in turn is somehow related to a generic java.lang.NullPointerException. However, when I replace that line with the following, the request works beautifully:
<Update typeName="mypoints:test_points">
My specific questions are as follows:
Is typeName="mypoints:test_points" actually the correct way to form the request?
If so, what am I doing wrong with ol.format.WFS to get this bad XML? Where is feature coming from?
Thank you in advance!
featureNS: "mypoints" is wrong, you should be using a URI instead

Navigate to PDF action for Orbeon button

I have set up a custom process for the submit button on some of my forms as below:
<property as="xs:string" name="oxf.fr.detail.process.submit.App.*">
require-valid
then confirm(message = "Are you sure you would like to submit the form?")
then suspend
then review
</property>
Instead of going to the review page, I would like it to navigate to the pdf copy of the form (as is done with the pdf button). I have has a look at the documentation, but haven't found an action for this. I have found pdf-url, but not sure how to use this to do what I want.
I found the xbl that is used to generate the pdf url for the pdf button, but got stuck on $app and $form being undefined.
<fr:href-button
xmlns:frf="java:org.orbeon.oxf.fr.FormRunner"
model="fr-persistence-model"
ref="instance('fr-triggers-instance')/pdf"
href=
"/fr/service/{
$app
}/{
$form
}/pdf/{{
string-join(
(
xxf:instance('fr-parameters-instance')/document/string(),
xxf:document-id(),
frf:filenameOrNull('pdf')[. != '']
),
'/'
)
}}.pdf">
<property as="xs:string" name="oxf.fr.detail.process.submit.App.*">
require-valid
then confirm(message = "Are you sure you would like to submit the form?")
then suspend
then navigate(uri = "/fr/service/{ $app }/{ $form }/pdf/{ string-join( ( xxf:instance('fr-parameters-instance')/document/string(), xxf:document-id()) , '/' ) }.pdf")
</property>
I've also noticed that it tries to confirm you want leave the page when it tries to redirect to the 404 of a pdf.
What would I replace then review with to go to the pdf?
Use:
navigate(
uri =
"/fr/service/{
xxf:instance('fr-parameters-instance')/app}/{
xxf:instance('fr-parameters-instance')/form}/pdf/{
string-join(
(
xxf:instance('fr-parameters-instance')/document/string(),
xxf:document-id()
),
'/')
}.pdf"
)
There should really be built-in functions to access the app name, form name, and document id. But for now you can access them from that fr-parameters-instance instance. The fr-parameters-instance contains:
<app></app>
<form></form>
<form-version></form-version>
<document></document>
<mode>new</mode>
<uuid/>
You can force the data status to safe with the set-data-status action.
work for me
uri =
"/fr/{
xxf:instance('fr-parameters-instance')/app}/{
xxf:instance('fr-parameters-instance')/form}/pdf/{
xxf:instance('fr-parameters-instance')/document/string()} "
)

extract private youtube playlist video links

I am trying to extract the video link of my private playlist. but i am unable to do
I used the below code to get the list
<?php
if(isset($_POST['send']))
{
$cont = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/playlists/'.$_POST['a'].'/?v=2')); ?>
<?php $feed = $cont->feed->entry; ?>
<?php if(count($feed)): foreach($feed as $item): // youtube start ?>
<?php echo $item->{'media$group'}->{'yt$videoid'}->{'$t'} ?>
<?php echo $item->title->{'$t'} ?>
<?php endforeach; endif; }?>
but this doesn't work. i need to extract only link with video title.
i have my account details with me how its possible using php
Since you want a private playlist, this will need to be an authenticated call, so you'll first have to set up an oAuth exchange. In PHP the easiest way to do this is with the gapi client; you can see more info (and get the library and sample code) here:
https://developers.google.com/youtube/v3/code_samples/php#retrieve_my_uploads
It will require you to use the client ID and secret for your registered app, though (don't forget to turn on the YouTube API v3 in the registered app!).
Once the oAuth is working, you can change the sample code listed above to very easily get your private playlist; starting with line 40, you'll have to use a call that's something like this:
$playlistResponse = $youtube->playlist->listPlaylists('contentDetails', array(
'id' => $_POST['a'], // assuming this variable represents the id of your playlist
));
You'll also have to somewhat modify the code after that block to be able to parse the playlist feed and get your info.

Youtube Video Upload in User Wall

I used the Facebook PHP SDK to upload a YouTube Video in the FB user wall.
I used the "source" option in "/USER_ID/feed/" of Graph API.
USER_ID is the logged in user's Facebook ID.
My code was working fine.
But Facebook made some changes in their API and the code is not working anymore.
Only the Youtube video image is showing but the Youtube video is not playing in facebook.
My code looks like this:-
$params = array(
'access_token' => $fbToken,
'message' => $name.' has shared a Vhybe',
'link' => $link,
'name' => 'Vhybe Social',
'caption' => $title,
'description' => $content
);
$sourceUrl = "https://www.youtube.com/v/".$videoId;
$imageUrl = "http://i4.ytimg.com/vi/".$videoId."/default.jpg";
$params['source'] = $sourceUrl;
$params['picture'] = $imageUrl;
$result = $facebook->api(
'/'.$userId.'/feed/',
'POST',
$params
);
I tried the "Graph API explorer" tool from the Facebook developer tools section
URL => https://developers.facebook.com/tools/
But i am getting the same results.
If the above process to upload Youtube video to user wall has been deprecated can you please suggest me an alternate process.
Thanks in advance.
Sincerely,
Sourav Mukherjee
Well the above code is working fine again.
I did not make any changes in my code.
Looks like Facebook corrected their own issue.
Sincerely,
Sourav Mukherjee

PHP: Using randomly generated and integrating a retweet/share button

I am trying to create a randomly generated phrase that can easily be shared amongst social media websites, specifically twitter. I am using the following PHP code to generate a random phrase.
This code looks in 'responses.txt' for a line with a phrase and I can call that line.
<!-- HEADER -->
<?php
$randomThings = file('**responses.txt**', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
?>
<!-- CALL SCRIPT -->
<?php
echo $randomThings[mt_rand(0,count($randomThings)-1)];
?>
How would I be able to have, for example, retweet button next to this generated line that retweets the phrase with a predetermined #hatchtag (via #[websitename]).
I'm more interested in the twitter aspect, but other social media websites could help other people.
The re-tweet intent itself has problems right now. It's been filed as a bug since November so I don't think you'll want to use the re-tweet functionality from an external website. You can simulate a re-tweet with a regular tweet intent and pre-filling in the text, (which sounds like what you actually want to do). With the tweet intent you send a HTTP request to https://twitter.com/intent/tweet. You could then include the text parameter to pre-fill the text when the HTTP request is sent, or the link is clicked.
Using your example it would look something like this:
<!-- HEADER -->
<?php
$randomThings = file('**responses.txt**', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
?>
<!-- CALL SCRIPT -->
<?php
$newThings = $randomThings[mt_rand(0,count($randomThings)-1)]; //must evaluate to a string
echo $newThings;
echo 'Link text';
?>
this would be an unstyled link instead of a "button" but you can adapt it to be a button using standard HTML/CSS styling.
ref: https://dev.twitter.com/docs/intents

Resources