8
votes

Comment utiliser l'API YouTube pour vérifier si une vidéo est intégrée?

Est-ce que quelqu'un sait comment vérifier si une vidéo YouTube est intégrée à l'aide de l'API YouTube? J'ai essayé d'utiliser cette URL:

entry: 
  rating: 
    rel: http://schemas.google.com/g/2005#overall
    max: "5"
    min: "1"
    average: "4.744681"
    numRaters: "94"
  group: 
    duration: 
      seconds: "47"
    player: 
      url: http://www.youtube.com/watch?v=47z7i79NuK8&feature=youtube_gdata_player
    category: Entertainment
    title: "Sesame Street: P is For Princess available everywhere on DVD!"
    thumbnail: 
    - time: "00:00:23.500"
      url: http://i.ytimg.com/vi/47z7i79NuK8/2.jpg
      height: "90"
      width: "120"
    - time: "00:00:11.750"
      url: http://i.ytimg.com/vi/47z7i79NuK8/1.jpg
      height: "90"
      width: "120"
    - time: "00:00:35.250"
      url: http://i.ytimg.com/vi/47z7i79NuK8/3.jpg
      height: "90"
      width: "120"
    - time: "00:00:23.500"
      url: http://i.ytimg.com/vi/47z7i79NuK8/0.jpg
      height: "240"
      width: "320"
    content: 
      duration: "47"
      medium: video
      yt:format: "5"
      isDefault: "true"
      url: http://www.youtube.com/v/47z7i79NuK8?f=videos&app=youtube_gdata
      expression: full
      type: application/x-shockwave-flash
    description: |-
      "Once upon a time on Sesame Street, there lived a fairy-in-training named Abby Cadabby, and she loved playing princess with friends like Rosita. But what happens when a misguided Prince (actor Paul Rudd) tries to rescue them? Pretending and the Letter P are the focus of this enchanting title, which also features fun with Natalie Portman and Elmo in "The Princess and The Elephant." This DVD also includes two bonus episodes of Sesame Street's new animated show, Abby's Flying Fairy School."

      www.sesamestreet.org/princess
    keywords: sesame street, muppets, princess, dvd, abby, abby's flying fairy school
  control: 
    state: Syndication of this video was restricted by its owner.
  category: 
  - term: http://gdata.youtube.com/schemas/2007#video
    scheme: http://schemas.google.com/g/2005#kind
  - label: Entertainment
    term: Entertainment
    scheme: http://gdata.youtube.com/schemas/2007/categories.cat
  - term: sesame street
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  - term: muppets
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  - term: princess
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  - term: dvd
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  - term: abby
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  - term: abby's flying fairy school
    scheme: http://gdata.youtube.com/schemas/2007/keywords.cat
  comments: 
    feedLink: 
      href: http://gdata.youtube.com/feeds/api/videos/47z7i79NuK8/comments
      countHint: "80"
  author: 
    name: SesameStreet
    uri: http://gdata.youtube.com/feeds/api/users/sesamestreet
  title: "Sesame Street: P is For Princess available everywhere on DVD!"
  statistics: 
    favoriteCount: "43"
    viewCount: "6003"
  published: "2010-10-08T19:18:09.000Z"
  xmlns:yt: http://gdata.youtube.com/schemas/2007
  id: http://gdata.youtube.com/feeds/api/videos/47z7i79NuK8
  xmlns:gd: http://schemas.google.com/g/2005
  content: |-
    "Once upon a time on Sesame Street, there lived a fairy-in-training named Abby Cadabby, and she loved playing princess with friends like Rosita. But what happens when a misguided Prince (actor Paul Rudd) tries to rescue them? Pretending and the Letter P are the focus of this enchanting title, which also features fun with Natalie Portman and Elmo in "The Princess and The Elephant." This DVD also includes two bonus episodes of Sesame Street's new animated show, Abby's Flying Fairy School."

    www.sesamestreet.org/princess
  link: 
  - href: http://www.youtube.com/watch?v=47z7i79NuK8&feature=youtube_gdata
    rel: alternate
    type: text/html
  - href: http://gdata.youtube.com/feeds/api/videos/47z7i79NuK8/related
    rel: http://gdata.youtube.com/schemas/2007#video.related
    type: application/atom+xml
  - href: http://gdata.youtube.com/feeds/api/videos/47z7i79NuK8
    rel: self
    type: application/atom+xml
  xmlns:media: http://search.yahoo.com/mrss/
  updated: "2010-10-10T06:36:39.000Z"
  xmlns:app: http://purl.org/atom/app#
  xmlns: http://www.w3.org/2005/Atom


0 commentaires

5 Réponses :



9
votes

En regardant le Référence de YouTube API , il apparaît que vous avez un Couple choix:

Spécifiez le paramètre "Format" lors de la recherche d'un clip:

Le paramètre Format Spécifie que les vidéos doivent être disponibles dans un format vidéo particulier. Votre demande peut spécifier l'un des formats suivants:

5 - URL HTTP sur le lecteur embeddable (SWF) pour cette vidéo. Ce format n'est pas disponible pour une vidéo qui n'est pas intégrée. Les développeurs ajoutent couramment et format = 5 à leurs requêtes pour restreindre les résultats aux vidéos pouvant être intégrées sur leurs sites.

ou référence le YT: Elément AccessControl:

Le Les balises indiquent si les utilisateurs sont autorisés à évaluer une vidéo, ajoutez des commentaires sur une vidéo, taper des commentaires sur la vidéo, ajoutez une réponse vidéo à la vidéo ou incorporer la Vidéo sur des sites Web tiers. Un autre paramètre indique si YouTube peut afficher la vidéo sur les propriétés YouTube autres que le site Web YouTube.com.

Syntaxe ressemblerait à quelque chose comme

Donc, dans votre exemple, il ressemble à la ligne YT: format: "5" vous indique que le clip peut être intégré.


0 commentaires

2
votes

Si vous pouvez utiliser le nouveau moyen sans objet de montrer une vidéo, vous verrez que presque toutes les vidéos non visibles avec la balise d'objet fonctionnent désormais impeccable.

Syntaxe est:

Articles qui pourrait vous intéresser :

Mode d'image dans l'image iframe Youtube
Fliter des vidéos en direct de l'API de recherche YouTube
YouTube peut désactiver l'accès de votre projet inactif au service API de données YouTube
Les articles de type org.json.jsonarray ne peuvent pas être convertis en JSONObject