Example #1
0
 def _get_data(self):
     try:
         if self.playlist:
             id = self._regex_id(self.playlist) # http://www.youku.com/playlist/rss/id/ + id
             feed_url = 'http://www.youku.com/playlist/rss/id/%s' % id
             req = utils.forge_request(feed_url.encode('utf-8'))
             rss = urllib2.urlopen(req).read()
             feed = feedparser.parse(rss)
             data = []
             for entry in feed.entries:
                 data.append(utils.dict2obj(entry))
             return data
     except:
         pass
     return []
Example #2
0
 def _get_data(self):
     try:
         if self.playlist:
             id = self._regex_id(self.playlist) # http://vimeo.com/channels/iphonehd
             feed_url = 'http://vimeo.com/api/v2/channel/%s/videos.json' % id
         elif self.user:
             id = self._regex_id(self.user) # http://vimeo.com/wyldstallyons
             feed_url = 'http://vimeo.com/api/v2/%s/videos.json' % id
         req = utils.forge_request(feed_url.encode('utf-8'))
         json = urllib2.urlopen(req).read()
         feed = simplejson.loads(json)
         # jsonfeed is a list of dictionaries
         # For update(), we need a list of objects. transforming the feed below.
         data = []
         for entry in feed:
             entry['link'] = entry['url']
             data.append(utils.dict2obj(entry))
         return data
     except:
         raise
         return []