[WORDPRESS] WordPress를 사용하여 YouTube에 비디오 업로드를 업로드합니다
WORDPRESSWordPress를 사용하여 YouTube에 비디오 업로드를 업로드합니다
해결법
-
1.ive 웹에서 찾은 lib (http://i-x.it/rej6en)를 사용하여 내 WordPress 사이트에 대해이 작업을 수행했습니다. 조금은 끈끈히 든다. 비디오를 직접 youtube에 보낼 수 있어야합니다 ..
ive 웹에서 찾은 lib (http://i-x.it/rej6en)를 사용하여 내 WordPress 사이트에 대해이 작업을 수행했습니다. 조금은 끈끈히 든다. 비디오를 직접 youtube에 보낼 수 있어야합니다 ..
<?php $youtube_email = ""; // Change this to your youtube sign in email. $youtube_password = ""; // Change this to your youtube sign in password. // Developer key: Get your key here: http://code.google.com/apis/youtube/dashboard/. $key = ""; $source = 'BarBeachTV'; // A short string that identifies your application for logging purposes. $postdata = "Email=".$youtube_email."&Passwd=".$youtube_password."&service=youtube&source=" . $source; $curl = curl_init( "https://www.google.com/youtube/accounts/ClientLogin" ); curl_setopt( $curl, CURLOPT_HEADER, "Content-Type:application/x-www-form-urlencoded" ); curl_setopt( $curl, CURLOPT_POST, 1 ); curl_setopt( $curl, CURLOPT_POSTFIELDS, $postdata ); curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 1 ); $response = curl_exec( $curl ); curl_close( $curl ); list( $auth, $youtubeuser ) = explode( "\n", $response ); list( $authlabel, $authvalue ) = array_map( "trim", explode( "=", $auth ) ); list( $youtubeuserlabel, $youtubeuservalue ) = array_map( "trim", explode( "=", $youtubeuser ) ); $youtube_video_title = $video_title; // This is the uploading video title. $youtube_video_description = $video_description; // This is the uploading video description. $youtube_video_keywords = 'BarBeachTV'; // This is the uploading video keywords. $youtube_video_category = 'Entertainment'; // This is the uploading video category. There are only certain categories that are accepted. See below /* * Accepted Categories: * Film Autos Music Animals Sports Travel Shortmov Games Videblog People Comedy Entertainment News Howto Education Tech Nonprofit Movies Movies_anime_action Movies_action_adventure Movies_classics Movies_comedy Movies_documentary Moves_drama Movies_family Movies_foreign Movies_horror Movies_sci_fi_fantasy Movies_thriller Movies_shorts Shows Trailers */ $data = '<?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">' . stripslashes( $youtube_video_title ) . '</media:title> <media:description type="plain">' . stripslashes( $youtube_video_description ) . '</media:description> <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">'.$youtube_video_category.'</media:category> <media:keywords>'.$youtube_video_keywords.'</media:keywords> </media:group> </entry>'; $headers = array( "Authorization: GoogleLogin auth=".$authvalue, "GData-Version: 2", "X-GData-Key: key=".$key, "Content-length: ".strlen( $data ), "Content-Type: application/atom+xml; charset=UTF-8" ); $curl = curl_init( "http://gdata.youtube.com/action/GetUploadToken"); curl_setopt( $curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"] ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_TIMEOUT, 10 ); curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $curl, CURLOPT_POST, 1 ); curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers ); curl_setopt( $curl, CURLOPT_POSTFIELDS, $data ); curl_setopt( $curl, CURLOPT_REFERER, true ); curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $curl, CURLOPT_HEADER, 0 ); $response = simplexml_load_string( curl_exec( $curl ) ); curl_close( $curl ); ?>
from https://stackoverflow.com/questions/9823268/uploading-videos-to-youtube-using-wordpress by cc-by-sa and MIT license
'WORDPRESS' 카테고리의 다른 글
[WORDPRESS] Woocommerce는 체크 아웃 페이지에서 합계를 얻습니다 (0) | 2020.11.22 |
---|---|
[WORDPRESS] 날짜별로 파일 목록을 정렬하십시오 (0) | 2020.11.22 |
[WORDPRESS] WooCommerce 장바구니 항목 수량 가격 계산을 비활성화하십시오 (0) | 2020.11.22 |
[WORDPRESS] 다중 레벨 카테고리 또는 메뉴 목록에서 항목 삭제 (0) | 2020.11.22 |
[WORDPRESS] WooCommerce - admin이 수신자 또는 주문 상태에 의해서만 BCC 전자 메일 만 (0) | 2020.11.22 |