Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
P
pima2018_25
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Opération
Environnements
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Clément VEYSSIÈRE
pima2018_25
Validations
45d858b4
Valider
45d858b4
rédigé
Il y a 6 ans
par
ZeyuC
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge branch 'feature-youtubeApi' into develop
parents
65b40cfc
2d57b9e9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
youtube-api/userInfos.php
+131
-2
131 ajouts, 2 suppressions
youtube-api/userInfos.php
avec
131 ajouts
et
2 suppressions
youtube-api/userInfos.php
+
131
−
2
Voir le fichier @
45d858b4
...
...
@@ -5,13 +5,12 @@
* Date: 2018/11/18
* Time: 16:16
*/
requir
e
'../vendor/autoload.php'
;
includ
e
'../vendor/autoload.php'
;
$setting
=
array
(
'key'
=>
'AIzaSyAg1Jz2Zxlna4sLJTE8BNpQlN2vSETqcHA'
);
function
searchByKey
(
$keyword
){
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
...
...
@@ -62,3 +61,133 @@ function getChannelViewCount($id) {
return
intval
(
$res
->
statistics
->
viewCount
);
}
function
getVideoInfoById
(
$id
){
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$res
=
$youtube
->
getVideoInfo
(
$id
);
return
$res
;
}
/**
* Search Get the name of the a video by ID
* @param Id
* @return the Name of a video
*/
function
getVideoNameById
(
$id
){
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$res
=
$youtube
->
getVideoInfo
(
$id
)
->
snippet
->
title
;
return
$res
;
}
/**
* Search Get the Icon of the a video by ID
* @param Id
* @return the Icon of a video
*/
function
getVideoIconById
(
$id
){
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$res
=
$youtube
->
getVideoInfo
(
$id
)
->
snippet
->
thumbnails
->
default
->
url
;
return
$res
;
}
/**
* Search Get the ViewCount of the a video by ID
* @param Id
* @return the viewCount of a video
*/
function
getVideoViewCountById
(
$id
){
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$res
=
$youtube
->
getVideoInfo
(
$id
)
->
statistics
->
viewCount
;
return
$res
;
}
/**
* Search Get the most populare count videos's id in a channel by channelID
* @param $channelId
* @param $count
* @return an array including the id of the most populare count videos
*/
function
getCountTopVideos
(
$channelId
,
$count
)
{
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$vid
=
$youtube
->
searchChannelVideos
(
''
,
$channelId
,
$count
,
"viewCount"
);
$CountList
=
array
();
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$CountList
[
$i
]
=
getVideoInfoById
(
$vid
[
$i
]
->
id
->
videoId
)
->
id
;
}
return
$CountList
;
}
/**
* Get the viewcount of the recent count videos by channelID
* @param $channelId
* @param $count
*/
function
getviewCountOfRecentVideo
(
$channelId
,
$count
)
{
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$vid
=
$youtube
->
searchChannelVideos
(
''
,
$channelId
,
$count
,
"date"
);
$ViewCountList
=
array
();
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$id
=
$vid
[
$i
]
->
id
->
videoId
;
$ViewCountList
[
$i
]
=
getVideoInfoById
(
$id
)
->
statistics
->
viewCount
;
}
return
$ViewCountList
;
}
/**
* Get the Likecount of the recent count videos by channelID
* @param $channelId
* @param $count
*/
function
getDislikeCountOfRecentVideo
(
$channelId
,
$count
)
{
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$vid
=
$youtube
->
searchChannelVideos
(
''
,
$channelId
,
$count
);
$CountList
=
array
();
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$CountList
[
$i
]
=
(
getVideoInfoById
(
$vid
[
$i
]
->
id
->
videoId
))
->
statistics
->
dislikeCount
;
}
return
$CountList
;
}
/**
* Search Get the DisLikecount of the recent count videos by channelID
* @param $channelId
* @param $count
*/
function
getLikeCountOfRecentVideo
(
$channelId
,
$count
)
{
global
$setting
;
$youtube
=
new
Madcoda\Youtube\Youtube
(
$setting
);
$vid
=
$youtube
->
searchChannelVideos
(
''
,
$channelId
,
$count
);
$CountList
=
array
();
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$CountList
[
$i
]
=
(
getVideoInfoById
(
$vid
[
$i
]
->
id
->
videoId
))
->
statistics
->
likeCount
;
}
return
$CountList
;
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter