Browse files

unbreak pickle support

  • Loading branch information...
1 parent 31d754f commit 4cb305146c9d20e92fd7ef019a09a7fe912f67b7 @noahsilas committed Jul 12, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 pytube/client.py
View
17 pytube/client.py
@@ -15,6 +15,13 @@
import pytube.exceptions
+class Category(str):
+ """ A simple str subclass;
+ by subclassing we can attach attributes to instances.
+ """
+ SCHEME = u'http://gdata.youtube.com/schemas/2007/categories.cat'
+
+
class LinksMixin(object):
""" Provides parsing of strangely formatted youtube api links objects
"""
@@ -89,20 +96,14 @@ class Video(YtData, LinksMixin):
EDIT_URL = "http://gdata.youtube.com/feeds/api/users/%(user_id)s/uploads/%(video_id)s"
- class Category(str):
- """ A simple str subclass;
- by subclassing we can attach attributes to instances.
- """
- SCHEME = u'http://gdata.youtube.com/schemas/2007/categories.cat'
-
def _parse_categories(self, data):
""" Given category data from the youtube API, parse it into the
category and keyword attributes on self.
"""
# parse the category
- categories = [c for c in data if c['scheme'] == Video.Category.SCHEME]
+ categories = [c for c in data if c['scheme'] == Category.SCHEME]
assert len(categories) == 1
- self.category = Video.Category(categories[0]['term'])
+ self.category = Category(categories[0]['term'])
self.category.label = categories[0]['label']
# parse keywords

0 comments on commit 4cb3051

Please sign in to comment.