Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do this using the <a href="https://developers.google.com/youtube/" rel="nofollow">YouTube API</a>. What you need to do is add an additional scope to your sign-in button. I would recommend you use the following scope:</p> <pre><code>https://www.googleapis.com/auth/youtube.readonly </code></pre> <p>Do this because you will not be managing anyone's YouTube account, just seeing their personal data (e.g. to pull in links or embed code for their YouTube videos).</p> <p>Next, you need to perform an API call to YouTube using a client library. For experimentation, you can <a href="https://developers.google.com/youtube/v3/docs/activities/list" rel="nofollow">use the API explorer</a>. To see your own information, authorize the request, set the part to "snippet" (no quotes) and then set mine to true.</p> <p>Download the "youtube", "v3" static class from <a href="https://code.google.com/p/google-api-php-client/downloads/list" rel="nofollow">the PHP Google API client library</a>, then make a call passing snippet as the part you want and "mine" set to true.</p> <p>For listing the current user's videos, there is <a href="https://code.google.com/p/google-api-php-client/source/browse/trunk/examples/youtube/my_uploads.php" rel="nofollow">an example that ships with the PHP client library</a>. The following change would list the user's activities:</p> <pre><code> // Exchange the OAuth 2.0 authorization code for user credentials. $client-&gt;authenticate($code); $token = json_decode($client-&gt;getAccessToken()); ... $activities = $youtube-&gt;activities-&gt;listActivities('snippet', array( 'mine' =&gt; 'true', )); foreach ($activities['items'] as $activity) { error_log(serialize($activity)); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload