PageRenderTime 45ms CodeModel.GetById 2ms app.highlight 38ms RepoModel.GetById 1ms app.codeStats 0ms

/gdata/youtube/__init__.py

http://radioappz.googlecode.com/
Python | 684 lines | 556 code | 74 blank | 54 comment | 1 complexity | 996d04927b8530a93b31a1d830a9b67a MD5 | raw file
  1#!/usr/bin/python
  2#
  3# Copyright (C) 2008 Google Inc.
  4#
  5# Licensed under the Apache License, Version 2.0 (the "License");
  6# you may not use this file except in compliance with the License.
  7# You may obtain a copy of the License at
  8#
  9#      http://www.apache.org/licenses/LICENSE-2.0
 10#
 11# Unless required by applicable law or agreed to in writing, software
 12# distributed under the License is distributed on an "AS IS" BASIS,
 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14# See the License for the specific language governing permissions and
 15# limitations under the License.
 16
 17__author__ = ('api.stephaniel@gmail.com (Stephanie Liu)'
 18              ', api.jhartmann@gmail.com (Jochen Hartmann)')
 19
 20import atom
 21import gdata
 22import gdata.media as Media
 23import gdata.geo as Geo
 24
 25YOUTUBE_NAMESPACE = 'http://gdata.youtube.com/schemas/2007'
 26YOUTUBE_FORMAT = '{http://gdata.youtube.com/schemas/2007}format'
 27YOUTUBE_DEVELOPER_TAG_SCHEME = '%s/%s' % (YOUTUBE_NAMESPACE,
 28                                          'developertags.cat')
 29YOUTUBE_SUBSCRIPTION_TYPE_SCHEME = '%s/%s' % (YOUTUBE_NAMESPACE,
 30                                              'subscriptiontypes.cat')
 31
 32class Username(atom.AtomBase):
 33  """The YouTube Username element"""
 34  _tag = 'username'
 35  _namespace = YOUTUBE_NAMESPACE
 36
 37class QueryString(atom.AtomBase):
 38  """The YouTube QueryString element"""
 39  _tag = 'queryString'
 40  _namespace = YOUTUBE_NAMESPACE
 41
 42
 43class FirstName(atom.AtomBase):
 44  """The YouTube FirstName element"""
 45  _tag = 'firstName'
 46  _namespace = YOUTUBE_NAMESPACE
 47
 48
 49class LastName(atom.AtomBase):
 50  """The YouTube LastName element"""
 51  _tag = 'lastName'
 52  _namespace = YOUTUBE_NAMESPACE
 53
 54
 55class Age(atom.AtomBase):
 56  """The YouTube Age element"""
 57  _tag = 'age'
 58  _namespace = YOUTUBE_NAMESPACE
 59
 60
 61class Books(atom.AtomBase):
 62  """The YouTube Books element"""
 63  _tag = 'books'
 64  _namespace = YOUTUBE_NAMESPACE  
 65
 66
 67class Gender(atom.AtomBase):
 68  """The YouTube Gender element"""
 69  _tag = 'gender'
 70  _namespace = YOUTUBE_NAMESPACE  
 71
 72
 73class Company(atom.AtomBase):
 74  """The YouTube Company element"""
 75  _tag = 'company'
 76  _namespace = YOUTUBE_NAMESPACE  
 77
 78
 79class Hobbies(atom.AtomBase):
 80  """The YouTube Hobbies element"""
 81  _tag = 'hobbies'
 82  _namespace = YOUTUBE_NAMESPACE  
 83
 84
 85class Hometown(atom.AtomBase):
 86  """The YouTube Hometown element"""
 87  _tag = 'hometown'
 88  _namespace = YOUTUBE_NAMESPACE  
 89
 90
 91class Location(atom.AtomBase):
 92  """The YouTube Location element"""
 93  _tag = 'location'
 94  _namespace = YOUTUBE_NAMESPACE 
 95
 96
 97class Movies(atom.AtomBase):
 98  """The YouTube Movies element"""
 99  _tag = 'movies'
100  _namespace = YOUTUBE_NAMESPACE    
101
102
103class Music(atom.AtomBase):
104  """The YouTube Music element"""
105  _tag = 'music'
106  _namespace = YOUTUBE_NAMESPACE    
107
108
109class Occupation(atom.AtomBase):
110  """The YouTube Occupation element"""
111  _tag = 'occupation'
112  _namespace = YOUTUBE_NAMESPACE  
113
114
115class School(atom.AtomBase):
116  """The YouTube School element"""
117  _tag = 'school'
118  _namespace = YOUTUBE_NAMESPACE  
119
120
121class Relationship(atom.AtomBase):
122  """The YouTube Relationship element"""
123  _tag = 'relationship'
124  _namespace = YOUTUBE_NAMESPACE  
125
126
127class Recorded(atom.AtomBase):
128  """The YouTube Recorded element"""
129  _tag = 'recorded'
130  _namespace = YOUTUBE_NAMESPACE
131
132
133class Statistics(atom.AtomBase):
134  """The YouTube Statistics element."""
135  _tag = 'statistics'
136  _namespace = YOUTUBE_NAMESPACE
137  _attributes = atom.AtomBase._attributes.copy() 
138  _attributes['viewCount'] = 'view_count'
139  _attributes['videoWatchCount'] = 'video_watch_count'
140  _attributes['subscriberCount'] = 'subscriber_count'
141  _attributes['lastWebAccess'] = 'last_web_access'
142  _attributes['favoriteCount'] = 'favorite_count'
143
144  def __init__(self, view_count=None, video_watch_count=None,
145               favorite_count=None, subscriber_count=None, last_web_access=None,
146               extension_elements=None, extension_attributes=None, text=None):
147
148    self.view_count = view_count
149    self.video_watch_count = video_watch_count
150    self.subscriber_count = subscriber_count
151    self.last_web_access = last_web_access
152    self.favorite_count = favorite_count
153
154    atom.AtomBase.__init__(self, extension_elements=extension_elements,
155                           extension_attributes=extension_attributes, text=text)
156
157
158class Status(atom.AtomBase):
159  """The YouTube Status element"""
160  _tag = 'status'
161  _namespace = YOUTUBE_NAMESPACE
162
163
164class Position(atom.AtomBase):
165  """The YouTube Position element. The position in a playlist feed."""
166  _tag = 'position'
167  _namespace = YOUTUBE_NAMESPACE  
168
169
170class Racy(atom.AtomBase):
171  """The YouTube Racy element."""
172  _tag = 'racy'
173  _namespace = YOUTUBE_NAMESPACE  
174
175class Description(atom.AtomBase):
176  """The YouTube Description element."""
177  _tag = 'description'
178  _namespace = YOUTUBE_NAMESPACE
179
180
181class Private(atom.AtomBase):
182  """The YouTube Private element."""
183  _tag = 'private'
184  _namespace = YOUTUBE_NAMESPACE
185
186
187class NoEmbed(atom.AtomBase):
188  """The YouTube VideoShare element. Whether a video can be embedded or not."""
189  _tag = 'noembed'
190  _namespace = YOUTUBE_NAMESPACE  
191
192
193class Comments(atom.AtomBase):
194  """The GData Comments element"""
195  _tag = 'comments'
196  _namespace = gdata.GDATA_NAMESPACE
197  _children = atom.AtomBase._children.copy()
198  _attributes = atom.AtomBase._attributes.copy()
199  _children['{%s}feedLink' % gdata.GDATA_NAMESPACE] = ('feed_link',
200                                                        [gdata.FeedLink])
201
202  def __init__(self, feed_link=None, extension_elements=None,
203               extension_attributes=None, text=None):
204
205    self.feed_link = feed_link
206    atom.AtomBase.__init__(self, extension_elements=extension_elements,
207                           extension_attributes=extension_attributes, text=text)
208
209
210class Rating(atom.AtomBase):
211  """The GData Rating element"""
212  _tag = 'rating'
213  _namespace = gdata.GDATA_NAMESPACE
214  _attributes = atom.AtomBase._attributes.copy()
215  _attributes['min'] = 'min'
216  _attributes['max'] = 'max'
217  _attributes['numRaters'] = 'num_raters'
218  _attributes['average'] = 'average'
219
220  def __init__(self, min=None, max=None,
221               num_raters=None, average=None, extension_elements=None,
222               extension_attributes=None, text=None):
223
224    self.min = min
225    self.max = max
226    self.num_raters = num_raters
227    self.average = average
228
229    atom.AtomBase.__init__(self, extension_elements=extension_elements,
230                           extension_attributes=extension_attributes, text=text)
231
232
233class YouTubePlaylistVideoEntry(gdata.GDataEntry):
234  """Represents a YouTubeVideoEntry on a YouTubePlaylist."""
235  _tag = gdata.GDataEntry._tag
236  _namespace = gdata.GDataEntry._namespace
237  _children = gdata.GDataEntry._children.copy()
238  _attributes = gdata.GDataEntry._attributes.copy()
239  _children['{%s}feedLink' % gdata.GDATA_NAMESPACE] = ('feed_link',
240                                                        [gdata.FeedLink])
241  _children['{%s}description' % YOUTUBE_NAMESPACE] = ('description',
242                                                       Description)
243  _children['{%s}rating' % gdata.GDATA_NAMESPACE] = ('rating', Rating)
244  _children['{%s}comments' % gdata.GDATA_NAMESPACE] = ('comments', Comments)
245  _children['{%s}statistics' % YOUTUBE_NAMESPACE] = ('statistics', Statistics)
246  _children['{%s}location' % YOUTUBE_NAMESPACE] = ('location', Location)
247  _children['{%s}position' % YOUTUBE_NAMESPACE] = ('position', Position)
248  _children['{%s}group' % gdata.media.MEDIA_NAMESPACE] = ('media', Media.Group)
249
250  def __init__(self, author=None, category=None, content=None,
251               atom_id=None, link=None, published=None, title=None,
252               updated=None, feed_link=None, description=None,
253               rating=None, comments=None, statistics=None,
254               location=None, position=None, media=None,
255               extension_elements=None, extension_attributes=None):
256
257    self.feed_link = feed_link
258    self.description = description
259    self.rating = rating
260    self.comments = comments
261    self.statistics = statistics
262    self.location = location
263    self.position = position
264    self.media = media
265
266    gdata.GDataEntry.__init__(self, author=author, category=category,
267                              content=content, atom_id=atom_id,
268                              link=link, published=published, title=title,
269                              updated=updated,
270                              extension_elements=extension_elements,
271                              extension_attributes=extension_attributes)
272
273
274class YouTubeVideoCommentEntry(gdata.GDataEntry):
275  """Represents a comment on YouTube."""
276  _tag = gdata.GDataEntry._tag
277  _namespace = gdata.GDataEntry._namespace
278  _children = gdata.GDataEntry._children.copy()
279  _attributes = gdata.GDataEntry._attributes.copy()
280
281
282class YouTubeSubscriptionEntry(gdata.GDataEntry):
283  """Represents a subscription entry on YouTube."""
284  _tag = gdata.GDataEntry._tag
285  _namespace = gdata.GDataEntry._namespace
286  _children = gdata.GDataEntry._children.copy()
287  _attributes = gdata.GDataEntry._attributes.copy()
288  _children['{%s}username' % YOUTUBE_NAMESPACE] = ('username', Username)
289  _children['{%s}queryString' % YOUTUBE_NAMESPACE] = (
290      'query_string', QueryString)
291  _children['{%s}feedLink' % gdata.GDATA_NAMESPACE] = ('feed_link',
292                                                        [gdata.FeedLink])
293
294  def __init__(self, author=None, category=None, content=None,
295               atom_id=None, link=None, published=None, title=None,
296               updated=None, username=None, query_string=None, feed_link=None,
297               extension_elements=None, extension_attributes=None):
298
299    gdata.GDataEntry.__init__(self, author=author, category=category,
300                              content=content, atom_id=atom_id, link=link,
301                              published=published, title=title, updated=updated)
302
303    self.username = username
304    self.query_string = query_string
305    self.feed_link = feed_link
306
307
308  def GetSubscriptionType(self):
309    """Retrieve the type of this subscription.
310
311    Returns:
312      A string that is either 'channel, 'query' or 'favorites'
313    """
314    for category in self.category:
315      if category.scheme == YOUTUBE_SUBSCRIPTION_TYPE_SCHEME:
316        return category.term
317
318
319class YouTubeVideoResponseEntry(gdata.GDataEntry):
320  """Represents a video response. """
321  _tag = gdata.GDataEntry._tag
322  _namespace = gdata.GDataEntry._namespace
323  _children = gdata.GDataEntry._children.copy()
324  _attributes = gdata.GDataEntry._attributes.copy()
325  _children['{%s}rating' % gdata.GDATA_NAMESPACE] = ('rating', Rating)
326  _children['{%s}noembed' % YOUTUBE_NAMESPACE] = ('noembed', NoEmbed)
327  _children['{%s}statistics' % YOUTUBE_NAMESPACE] = ('statistics', Statistics)
328  _children['{%s}racy' % YOUTUBE_NAMESPACE] = ('racy', Racy)
329  _children['{%s}group' % gdata.media.MEDIA_NAMESPACE] = ('media', Media.Group)
330
331  def __init__(self, author=None, category=None, content=None, atom_id=None,
332               link=None, published=None, title=None, updated=None, rating=None,
333               noembed=None, statistics=None, racy=None, media=None,
334               extension_elements=None, extension_attributes=None):
335
336    gdata.GDataEntry.__init__(self, author=author, category=category,
337                              content=content, atom_id=atom_id, link=link,
338                              published=published, title=title, updated=updated)
339
340    self.rating = rating
341    self.noembed = noembed
342    self.statistics = statistics
343    self.racy = racy
344    self.media = media or Media.Group()
345
346
347class YouTubeContactEntry(gdata.GDataEntry):
348  """Represents a contact entry."""
349  _tag = gdata.GDataEntry._tag
350  _namespace = gdata.GDataEntry._namespace
351  _children = gdata.GDataEntry._children.copy()
352  _attributes = gdata.GDataEntry._attributes.copy()
353  _children['{%s}username' % YOUTUBE_NAMESPACE] = ('username', Username)
354  _children['{%s}status' % YOUTUBE_NAMESPACE] = ('status', Status)
355
356
357  def __init__(self, author=None, category=None, content=None, atom_id=None,
358               link=None, published=None, title=None, updated=None,
359               username=None, status=None, extension_elements=None, 
360               extension_attributes=None, text=None):
361
362    gdata.GDataEntry.__init__(self, author=author, category=category,
363                              content=content, atom_id=atom_id, link=link,
364                              published=published, title=title, updated=updated)
365
366    self.username = username
367    self.status = status
368
369
370class YouTubeVideoEntry(gdata.GDataEntry):
371  """Represents a video on YouTube."""
372  _tag = gdata.GDataEntry._tag
373  _namespace = gdata.GDataEntry._namespace
374  _children = gdata.GDataEntry._children.copy()
375  _attributes = gdata.GDataEntry._attributes.copy()
376  _children['{%s}rating' % gdata.GDATA_NAMESPACE] = ('rating', Rating)
377  _children['{%s}comments' % gdata.GDATA_NAMESPACE] = ('comments', Comments)
378  _children['{%s}noembed' % YOUTUBE_NAMESPACE] = ('noembed', NoEmbed)
379  _children['{%s}statistics' % YOUTUBE_NAMESPACE] = ('statistics', Statistics)
380  _children['{%s}recorded' % YOUTUBE_NAMESPACE] = ('recorded', Recorded)
381  _children['{%s}racy' % YOUTUBE_NAMESPACE] = ('racy', Racy)
382  _children['{%s}group' % gdata.media.MEDIA_NAMESPACE] = ('media', Media.Group)
383  _children['{%s}where' % gdata.geo.GEORSS_NAMESPACE] = ('geo', Geo.Where)
384
385  def __init__(self, author=None, category=None, content=None, atom_id=None,
386               link=None, published=None, title=None, updated=None, rating=None,
387               noembed=None, statistics=None, racy=None, media=None, geo=None,
388               recorded=None, comments=None, extension_elements=None, 
389               extension_attributes=None):
390
391    self.rating = rating
392    self.noembed = noembed
393    self.statistics = statistics
394    self.racy = racy
395    self.comments = comments
396    self.media = media or Media.Group()
397    self.geo = geo
398    self.recorded = recorded
399
400    gdata.GDataEntry.__init__(self, author=author, category=category,
401                              content=content, atom_id=atom_id, link=link,
402                              published=published, title=title, updated=updated,
403                              extension_elements=extension_elements,
404                              extension_attributes=extension_attributes)
405
406  def GetSwfUrl(self):
407    """Return the URL for the embeddable Video
408
409      Returns:
410          URL of the embeddable video
411    """
412    if self.media.content:
413      for content in self.media.content:
414        if content.extension_attributes[YOUTUBE_FORMAT] == '5':
415          return content.url
416    else:
417      return None
418
419  def AddDeveloperTags(self, developer_tags):
420    """Add a developer tag for this entry.
421
422    Developer tags can only be set during the initial upload.
423
424    Arguments:
425      developer_tags: A list of developer tags as strings.
426
427    Returns:
428      A list of all developer tags for this video entry.
429    """
430    for tag_text in developer_tags:
431      self.media.category.append(gdata.media.Category(
432          text=tag_text, label=tag_text, scheme=YOUTUBE_DEVELOPER_TAG_SCHEME))
433
434    return self.GetDeveloperTags()
435
436  def GetDeveloperTags(self):
437    """Retrieve developer tags for this video entry."""
438    developer_tags = []
439    for category in self.media.category:
440      if category.scheme == YOUTUBE_DEVELOPER_TAG_SCHEME:
441        developer_tags.append(category)
442    if len(developer_tags) > 0:
443      return developer_tags
444
445  def GetYouTubeCategoryAsString(self):
446    """Convenience method to return the YouTube category as string.
447
448    YouTubeVideoEntries can contain multiple Category objects with differing 
449        schemes. This method returns only the category with the correct
450        scheme, ignoring developer tags.
451    """
452    for category in self.media.category:
453      if category.scheme != YOUTUBE_DEVELOPER_TAG_SCHEME:
454        return category.text
455
456class YouTubeUserEntry(gdata.GDataEntry):
457  """Represents a user on YouTube."""
458  _tag = gdata.GDataEntry._tag
459  _namespace = gdata.GDataEntry._namespace
460  _children = gdata.GDataEntry._children.copy()
461  _attributes = gdata.GDataEntry._attributes.copy()
462  _children['{%s}username' % YOUTUBE_NAMESPACE] = ('username', Username)
463  _children['{%s}firstName' % YOUTUBE_NAMESPACE] = ('first_name', FirstName)
464  _children['{%s}lastName' % YOUTUBE_NAMESPACE] = ('last_name', LastName)
465  _children['{%s}age' % YOUTUBE_NAMESPACE] = ('age', Age)
466  _children['{%s}books' % YOUTUBE_NAMESPACE] = ('books', Books)
467  _children['{%s}gender' % YOUTUBE_NAMESPACE] = ('gender', Gender)
468  _children['{%s}company' % YOUTUBE_NAMESPACE] = ('company', Company)
469  _children['{%s}description' % YOUTUBE_NAMESPACE] = ('description',
470                                                       Description)
471  _children['{%s}hobbies' % YOUTUBE_NAMESPACE] = ('hobbies', Hobbies)
472  _children['{%s}hometown' % YOUTUBE_NAMESPACE] = ('hometown', Hometown)
473  _children['{%s}location' % YOUTUBE_NAMESPACE] = ('location', Location)
474  _children['{%s}movies' % YOUTUBE_NAMESPACE] = ('movies', Movies)
475  _children['{%s}music' % YOUTUBE_NAMESPACE] = ('music', Music)
476  _children['{%s}occupation' % YOUTUBE_NAMESPACE] = ('occupation', Occupation)
477  _children['{%s}school' % YOUTUBE_NAMESPACE] = ('school', School)
478  _children['{%s}relationship' % YOUTUBE_NAMESPACE] = ('relationship',
479                                                        Relationship)
480  _children['{%s}statistics' % YOUTUBE_NAMESPACE] = ('statistics', Statistics)
481  _children['{%s}feedLink' % gdata.GDATA_NAMESPACE] = ('feed_link',
482                                                        [gdata.FeedLink])
483  _children['{%s}thumbnail' % gdata.media.MEDIA_NAMESPACE] = ('thumbnail',
484                                                               Media.Thumbnail)
485
486  def __init__(self, author=None, category=None, content=None, atom_id=None,
487               link=None, published=None, title=None, updated=None,
488               username=None, first_name=None, last_name=None, age=None,
489               books=None, gender=None, company=None, description=None,
490               hobbies=None, hometown=None, location=None, movies=None,
491               music=None, occupation=None, school=None, relationship=None,
492               statistics=None, feed_link=None, extension_elements=None,
493               extension_attributes=None, text=None):
494
495    self.username = username
496    self.first_name = first_name
497    self.last_name = last_name
498    self.age = age
499    self.books = books
500    self.gender = gender
501    self.company = company
502    self.description = description
503    self.hobbies = hobbies
504    self.hometown = hometown
505    self.location = location
506    self.movies = movies
507    self.music = music
508    self.occupation = occupation
509    self.school = school
510    self.relationship = relationship
511    self.statistics = statistics
512    self.feed_link = feed_link
513
514    gdata.GDataEntry.__init__(self, author=author, category=category,
515                              content=content, atom_id=atom_id,
516                              link=link, published=published,
517                              title=title, updated=updated,
518                              extension_elements=extension_elements,
519                              extension_attributes=extension_attributes,
520                              text=text)
521
522
523class YouTubeVideoFeed(gdata.GDataFeed, gdata.LinkFinder):
524  """Represents a video feed on YouTube."""
525  _tag = gdata.GDataFeed._tag
526  _namespace = gdata.GDataFeed._namespace
527  _children = gdata.GDataFeed._children.copy()
528  _attributes = gdata.GDataFeed._attributes.copy()
529  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [YouTubeVideoEntry])
530
531class YouTubePlaylistEntry(gdata.GDataEntry):
532  """Represents a playlist in YouTube."""
533  _tag = gdata.GDataEntry._tag
534  _namespace = gdata.GDataEntry._namespace
535  _children = gdata.GDataEntry._children.copy()
536  _attributes = gdata.GDataEntry._attributes.copy()
537  _children['{%s}description' % YOUTUBE_NAMESPACE] = ('description',
538                                                       Description)
539  _children['{%s}private' % YOUTUBE_NAMESPACE] = ('private',
540                                                  Private)
541  _children['{%s}feedLink' % gdata.GDATA_NAMESPACE] = ('feed_link',
542                                                        [gdata.FeedLink])
543
544  def __init__(self, author=None, category=None, content=None,
545               atom_id=None, link=None, published=None, title=None,
546               updated=None, private=None, feed_link=None,
547               description=None, extension_elements=None,
548               extension_attributes=None):
549
550    self.description = description
551    self.private = private
552    self.feed_link = feed_link
553
554    gdata.GDataEntry.__init__(self, author=author, category=category,
555                              content=content, atom_id=atom_id,
556                              link=link, published=published, title=title, 
557                              updated=updated,
558                              extension_elements=extension_elements,
559                              extension_attributes=extension_attributes)
560
561
562
563class YouTubePlaylistFeed(gdata.GDataFeed, gdata.LinkFinder):
564  """Represents a feed of a user's playlists """
565  _tag = gdata.GDataFeed._tag
566  _namespace = gdata.GDataFeed._namespace
567  _children = gdata.GDataFeed._children.copy()
568  _attributes = gdata.GDataFeed._attributes.copy()
569  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
570                                                  [YouTubePlaylistEntry])
571
572
573class YouTubePlaylistVideoFeed(gdata.GDataFeed, gdata.LinkFinder):
574  """Represents a feed of video entry on a playlist."""
575  _tag = gdata.GDataFeed._tag
576  _namespace = gdata.GDataFeed._namespace
577  _children = gdata.GDataFeed._children.copy()
578  _attributes = gdata.GDataFeed._attributes.copy()
579  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
580                                                  [YouTubePlaylistVideoEntry])
581
582
583class YouTubeContactFeed(gdata.GDataFeed, gdata.LinkFinder):
584  """Represents a feed of a users contacts."""
585  _tag = gdata.GDataFeed._tag
586  _namespace = gdata.GDataFeed._namespace
587  _children = gdata.GDataFeed._children.copy()
588  _attributes = gdata.GDataFeed._attributes.copy()
589  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
590                                                  [YouTubeContactEntry])
591
592
593class YouTubeSubscriptionFeed(gdata.GDataFeed, gdata.LinkFinder):
594  """Represents a feed of a users subscriptions."""
595  _tag = gdata.GDataFeed._tag
596  _namespace = gdata.GDataFeed._namespace
597  _children = gdata.GDataFeed._children.copy()
598  _attributes = gdata.GDataFeed._attributes.copy()
599  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
600                                                  [YouTubeSubscriptionEntry])
601
602
603class YouTubeVideoCommentFeed(gdata.GDataFeed, gdata.LinkFinder):
604  """Represents a feed of comments for a video."""
605  _tag = gdata.GDataFeed._tag
606  _namespace = gdata.GDataFeed._namespace
607  _children = gdata.GDataFeed._children.copy()
608  _attributes = gdata.GDataFeed._attributes.copy()
609  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
610                                                  [YouTubeVideoCommentEntry])
611
612
613class YouTubeVideoResponseFeed(gdata.GDataFeed, gdata.LinkFinder):
614  """Represents a feed of video responses."""
615  _tag = gdata.GDataFeed._tag
616  _namespace = gdata.GDataFeed._namespace
617  _children = gdata.GDataFeed._children.copy()
618  _attributes = gdata.GDataFeed._attributes.copy()
619  _children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry',
620                                                  [YouTubeVideoResponseEntry])
621
622
623def YouTubeVideoFeedFromString(xml_string):
624  return atom.CreateClassFromXMLString(YouTubeVideoFeed, xml_string)
625
626
627def YouTubeVideoEntryFromString(xml_string):
628  return atom.CreateClassFromXMLString(YouTubeVideoEntry, xml_string)
629
630
631def YouTubeContactFeedFromString(xml_string):
632  return atom.CreateClassFromXMLString(YouTubeContactFeed, xml_string)
633
634
635def YouTubeContactEntryFromString(xml_string):
636  return atom.CreateClassFromXMLString(YouTubeContactEntry, xml_string)
637
638
639def YouTubeVideoCommentFeedFromString(xml_string):
640  return atom.CreateClassFromXMLString(YouTubeVideoCommentFeed, xml_string)
641
642
643def YouTubeVideoCommentEntryFromString(xml_string):
644  return atom.CreateClassFromXMLString(YouTubeVideoCommentEntry, xml_string)
645
646
647def YouTubeUserFeedFromString(xml_string):
648  return atom.CreateClassFromXMLString(YouTubeVideoFeed, xml_string)
649
650
651def YouTubeUserEntryFromString(xml_string):
652  return atom.CreateClassFromXMLString(YouTubeUserEntry, xml_string)
653
654
655def YouTubePlaylistFeedFromString(xml_string):
656  return atom.CreateClassFromXMLString(YouTubePlaylistFeed, xml_string)
657
658
659def YouTubePlaylistVideoFeedFromString(xml_string):
660  return atom.CreateClassFromXMLString(YouTubePlaylistVideoFeed, xml_string)
661
662
663def YouTubePlaylistEntryFromString(xml_string):
664  return atom.CreateClassFromXMLString(YouTubePlaylistEntry, xml_string)
665
666
667def YouTubePlaylistVideoEntryFromString(xml_string):
668  return atom.CreateClassFromXMLString(YouTubePlaylistVideoEntry, xml_string)
669
670
671def YouTubeSubscriptionFeedFromString(xml_string):
672  return atom.CreateClassFromXMLString(YouTubeSubscriptionFeed, xml_string)
673
674
675def YouTubeSubscriptionEntryFromString(xml_string):
676  return atom.CreateClassFromXMLString(YouTubeSubscriptionEntry, xml_string)
677
678
679def YouTubeVideoResponseFeedFromString(xml_string):
680  return atom.CreateClassFromXMLString(YouTubeVideoResponseFeed, xml_string)
681
682
683def YouTubeVideoResponseEntryFromString(xml_string):
684  return atom.CreateClassFromXMLString(YouTubeVideoResponseEntry, xml_string)