小编gho*_*ost的帖子

youtube data api 3 php,如何从频道获取50多个视频?

我工作的一个项目,该项目requirs使用youtubedata API 3.0列出了从一个频道的所有影片,但没有从GDATA(饲料),API返回的通道只有50视频,并没有提到获得developers.google更多视频.救命.这是我的代码

<?php

require_once 'contrib/Google_YoutubeService.php';*/
require_once '../upload/google-api-php-client/src/Google_Client.php';
    require_once '../upload/google-api-php-client/src/contrib/Google_YouTubeService.php';
session_start();

/* You can acquire an OAuth 2 ID/secret pair from the API Access tab on the Google APIs Console
  <http://code.google.com/apis/console#access>
For more information about using OAuth2 to access Google APIs, please visit:
  <https://developers.google.com/accounts/docs/OAuth2>
Please ensure that you have enabled the YouTube Data API for your project. */
$OAUTH2_CLIENT_ID = 'sadsadsadasdsad';
$OAUTH2_CLIENT_SECRET = 'sadsadsadasdasdasdasd';

$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'],
  FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);

$youtube …
Run Code Online (Sandbox Code Playgroud)

php api youtube-api

9
推荐指数
2
解决办法
7701
查看次数

带数据获取的 SSR,没有状态管理库

我正在尝试制作一个 SSR 反应应用程序,但无法将道具从 express 传递到组件。我在做什么错误?

服务器.js

import AppPage2 from './src/project02/LandingPage';
......
......
server.get('/project2',async (req,res)=>{
    const context = {data:'test'}
    const sheet = new ServerStyleSheet();
    const content = ReactDOMServer.renderToString(sheet.collectStyles(
        <StaticRouter location={req.url} context={context}>
            <AppPage2 state={{"foo":"baar"}}/>
        </StaticRouter>)
    );
    const styles = sheet.getStyleTags();
    let html = appShell( 'Project 2', content,' project2.bundle.js',styles)
    res.status(200).send(html);
    res.end()
})
Run Code Online (Sandbox Code Playgroud)

AppPage2(./src/project02/LandingPage)

import React from 'react';
import {Wrapper,Title}  from './styleComponent/testStylePage'
.......
.......
class AppPage extends React.Component {

    componentDidMount() {
       console.log("{{API}}",this,this.props, this.props.staticContext)
    }

    render(){
        return(
            <Wrapper>
                <Title>This is project 01 </Title>
            </Wrapper>
        ) …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-router isomorphic-javascript server-side-rendering

5
推荐指数
1
解决办法
193
查看次数