コード例 #1
0
 def search_videos_by_keyword(self,
                              keyword,
                              category=None,
                              period='week',
                              orderby='relevance',
                              public_type='all',
                              paid=None,
                              timeless=None,
                              timemore=None,
                              streamtypes=None,
                              page=1,
                              count=20):
     """doc: http://open.youku.com/docs/doc?id=81
     """
     url = 'https://openapi.youku.com/v2/searches/video/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'category': category,
         'period': period,
         'orderby': orderby,
         'public_type': public_type,
         'paid': paid,
         'timeless': timeless,
         'timemore': timemore,
         'streamtypes': streamtypes,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #2
0
 def search_shows_by_keyword(self,
                             keyword,
                             unite=0,
                             source_site=None,
                             category=None,
                             release_year=None,
                             area=None,
                             orderby='view-count',
                             paid=None,
                             hasvideotype=None,
                             page=1,
                             count=20):
     """doc: http://open.youku.com/docs/doc?id=82
     """
     url = 'https://openapi.youku.com/v2/searches/show/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'unite': unite,
         'source_site': source_site,
         'category': category,
         'release_year': release_year,
         'area': area,
         'orderby': orderby,
         'paid': paid,
         'hasvideotype': hasvideotype,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #3
0
 def find_shows_by_category(self,
                            category,
                            genre=None,
                            area=None,
                            release_year=None,
                            paid=None,
                            orderby='view-today-count',
                            streamtypes=None,
                            person=None,
                            page=1,
                            count=20):
     """doc: http://open.youku.com/docs/doc?id=62
     """
     url = 'https://openapi.youku.com/v2/shows/by_category.json'
     params = {
         'client_id': self.client_id,
         'category': category,
         'genre': genre,
         'area': area,
         'release_year': release_year,
         'paid': paid,
         'orderby': orderby,
         'streamtypes': streamtypes,
         'person': person,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #4
0
 def search_show_top_unite(self,
                           category,
                           genre=None,
                           area=None,
                           year=None,
                           orderby=None,
                           headnum=1,
                           tailnum=1,
                           onesiteflag=None,
                           page=1,
                           count=20):
     """doc: http://open.youku.com/docs/doc?id=86
     """
     url = 'https://openapi.youku.com/v2/searches/show/top_unite.json'
     params = {
         'client_id': self.client_id,
         'category': category,
         'genre': genre,
         'area': area,
         'year': year,
         'orderby': orderby,
         'headnum': headnum,
         'tailnum': tailnum,
         'onesiteflag': onesiteflag,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #5
0
ファイル: youku_searches.py プロジェクト: nsdown/youku
 def search_videos_by_keyword(self, keyword, category=None,
                              period='week', orderby='relevance',
                              public_type='all', paid=None,
                              timeless=None, timemore=None,
                              streamtypes=None,
                              page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=81
     """
     url = 'https://openapi.youku.com/v2/searches/video/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'category': category,
         'period': period,
         'orderby': orderby,
         'public_type': public_type,
         'paid': paid,
         'timeless': timeless,
         'timemore': timemore,
         'streamtypes': streamtypes,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #6
0
ファイル: youku_shows.py プロジェクト: nsdown/youku
 def find_shows_by_category(self, category, genre=None, area=None,
                            release_year=None, paid=None,
                            orderby='view-today-count',
                            streamtypes=None, person=None,
                            page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=62
     """
     url = 'https://openapi.youku.com/v2/shows/by_category.json'
     params = {
         'client_id': self.client_id,
         'category': category,
         'genre': genre,
         'area': area,
         'release_year': release_year,
         'paid': paid,
         'orderby': orderby,
         'streamtypes': streamtypes,
         'person': person,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #7
0
 def find_persons_by_type(self,
                          type,
                          nationality=None,
                          gender=None,
                          firstletter=None,
                          orderby='view-week-count',
                          page=1,
                          count=20):
     """doc: http://open.youku.com/docs/docs?id=89
     """
     url = 'https://openapi.youku.com/v2/persons/by_type.json'
     params = {
         'client_id': self.client_id,
         'type': type,
         'nationality': nationality,
         'gender': gender,
         'firstletter': firstletter,
         'orderby': orderby,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #8
0
ファイル: youku_searches.py プロジェクト: nsdown/youku
 def search_shows_by_keyword(self, keyword, unite=0, source_site=None,
                             category=None, release_year=None,
                             area=None, orderby='view-count',
                             paid=None, hasvideotype=None,
                             page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=82
     """
     url = 'https://openapi.youku.com/v2/searches/show/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'unite': unite,
         'source_site': source_site,
         'category': category,
         'release_year': release_year,
         'area': area,
         'orderby': orderby,
         'paid': paid,
         'hasvideotype': hasvideotype,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #9
0
ファイル: youku_videos.py プロジェクト: cash2one/AutoSystem
 def update_video(self,
                  access_token,
                  video_id,
                  title=None,
                  tags=None,
                  category=None,
                  copyright_type=None,
                  public_type=None,
                  watch_password=None,
                  description=None,
                  thumbnail_seq=None):
     """doc: http://open.youku.com/docs/doc?id=50
     """
     url = 'https://openapi.youku.com/v2/videos/update.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'video_id': video_id,
         'title': title,
         'tags': tags,
         'category': category,
         'copyright_type': copyright_type,
         'public_type': public_type,
         'watch_password': watch_password,
         'description': description,
         'thumbnail_seq': thumbnail_seq
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data, verify=False)
     check_error(r)
     return r.json()['id']
コード例 #10
0
 def _find_users(self, user_ids=None, user_names=None):
     url = 'https://openapi.youku.com/v2/users/show_batch.json'
     data = {
         'client_id': self.client_id,
         'user_ids': user_ids,
         'user_names': user_names
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     if r.status_code == 400:
         # Youku return 400 if no result, but this is not friendly.
         return None
     check_error(r)
     return r.json()
コード例 #11
0
ファイル: youku_users.py プロジェクト: nsdown/youku
 def _find_users(self, user_ids=None, user_names=None):
     url = 'https://openapi.youku.com/v2/users/show_batch.json'
     data = {
         'client_id': self.client_id,
         'user_ids': user_ids,
         'user_names': user_names
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     if r.status_code == 400:
         # Youku return 400 if no result, but this is not friendly.
         return None
     check_error(r)
     return r.json()
コード例 #12
0
 def destroy_friendship(self, access_token, user_id=None, user_name=None):
     """doc: ??
     """
     url = 'https://openapi.youku.com/v2/users/friendship/destroy.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'user_id': user_id,
         'user_name': user_name
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
コード例 #13
0
ファイル: youku_users.py プロジェクト: nsdown/youku
 def destroy_friendship(self, access_token,
                        user_id=None, user_name=None):
     """doc: ??
     """
     url = 'https://openapi.youku.com/v2/users/friendship/destroy.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'user_id': user_id,
         'user_name': user_name
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
コード例 #14
0
ファイル: youku_searches.py プロジェクト: nsdown/youku
 def search_show_address_unite(self, progammeId,
                               source_site=None, type=None):
     """doc: http://open.youku.com/docs/doc?id=85
     """
     url = 'https://openapi.youku.com/v2/searches/show/address_unite.json'
     params = {
         'client_id': self.client_id,
         'progammeId': progammeId,
         'source_site': source_site,
         'type': type
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #15
0
ファイル: youku_users.py プロジェクト: nsdown/youku
 def friendship_followers(self, user_id=None, user_name=None,
                          page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=27
     """
     url = 'https://openapi.youku.com/v2/users/friendship/followers.json'
     data = {
         'client_id': self.client_id,
         'page': page,
         'count': count,
         'user_id': user_id,
         'user_name': user_name
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
コード例 #16
0
 def search_show_address_unite(self,
                               progammeId,
                               source_site=None,
                               type=None):
     """doc: http://open.youku.com/docs/doc?id=85
     """
     url = 'https://openapi.youku.com/v2/searches/show/address_unite.json'
     params = {
         'client_id': self.client_id,
         'progammeId': progammeId,
         'source_site': source_site,
         'type': type
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #17
0
 def create_playlist(self, access_token, title, tags,
                     category=None, description=None):
     """doc: http://open.youku.com/docs/doc?id=72
     """
     url = 'https://openapi.youku.com/v2/playlists/create.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'title': title,
         'tags': tags,
         'category': category,
         'description': description
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()['id']
コード例 #18
0
ファイル: youku_playlists.py プロジェクト: nsdown/youku
 def create_playlist(self, access_token, title, tags,
                     category=None, description=None):
     """doc: http://open.youku.com/docs/doc?id=72
     """
     url = 'https://openapi.youku.com/v2/playlists/create.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'title': title,
         'tags': tags,
         'category': category,
         'description': description
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()['id']
コード例 #19
0
ファイル: youku_comments.py プロジェクト: nsdown/youku
 def create_comment(self, access_token, video_id, content,
                    reply_id=None, captcha_key=None, captcha_text=None):
     """doc: http://open.youku.com/docs/doc?id=41
     """
     url = 'https://openapi.youku.com/v2/comments/create.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'video_id': video_id,
         'content': content,
         'reply_id': reply_id,
         'captcha_key': captcha_key,
         'captcha_text': captcha_text
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()['id']
コード例 #20
0
 def friendship_followers(self,
                          user_id=None,
                          user_name=None,
                          page=1,
                          count=20):
     """doc: http://open.youku.com/docs/doc?id=27
     """
     url = 'https://openapi.youku.com/v2/users/friendship/followers.json'
     data = {
         'client_id': self.client_id,
         'page': page,
         'count': count,
         'user_id': user_id,
         'user_name': user_name
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
コード例 #21
0
ファイル: youku_shows.py プロジェクト: nsdown/youku
 def find_videos_by_show(self, show_id, show_videotype=None,
                         show_videostage=None, orderby='videoseq-asc',
                         page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=64
     """
     url = 'https://openapi.youku.com/v2/shows/videos.json'
     params = {
         'client_id': self.client_id,
         'show_id': show_id,
         'page': page,
         'count': count,
         'show_videotype': show_videotype,
         'show_videostage': show_videostage,
         'orderby': orderby
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #22
0
ファイル: youku_persons.py プロジェクト: nsdown/youku
 def find_persons_by_type(self, type, nationality=None, gender=None,
                          firstletter=None, orderby='view-week-count',
                          page=1, count=20):
     """doc: http://open.youku.com/docs/docs?id=89
     """
     url = 'https://openapi.youku.com/v2/persons/by_type.json'
     params = {
         'client_id': self.client_id,
         'type': type,
         'nationality': nationality,
         'gender': gender,
         'firstletter': firstletter,
         'orderby': orderby,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #23
0
 def create_comment(self,
                    access_token,
                    video_id,
                    content,
                    reply_id=None,
                    captcha_key=None,
                    captcha_text=None):
     """doc: http://open.youku.com/docs/doc?id=41
     """
     url = 'https://openapi.youku.com/v2/comments/create.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'video_id': video_id,
         'content': content,
         'reply_id': reply_id,
         'captcha_key': captcha_key,
         'captcha_text': captcha_text
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()['id']
コード例 #24
0
 def find_videos_by_show(self,
                         show_id,
                         show_videotype=None,
                         show_videostage=None,
                         orderby='videoseq-asc',
                         page=1,
                         count=20):
     """doc: http://open.youku.com/docs/doc?id=64
     """
     url = 'https://openapi.youku.com/v2/shows/videos.json'
     params = {
         'client_id': self.client_id,
         'show_id': show_id,
         'page': page,
         'count': count,
         'show_videotype': show_videotype,
         'show_videostage': show_videostage,
         'orderby': orderby
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
コード例 #25
0
ファイル: youku_videos.py プロジェクト: nsdown/youku
 def update_video(self, access_token, video_id, title=None,
                  tags=None, category=None, copyright_type=None,
                  public_type=None, watch_password=None,
                  description=None, thumbnail_seq=None):
     """doc: http://open.youku.com/docs/doc?id=50
     """
     url = 'https://openapi.youku.com/v2/videos/update.json'
     data = {
         'client_id': self.client_id,
         'access_token': access_token,
         'video_id': video_id,
         'title': title,
         'tags': tags,
         'category': category,
         'copyright_type': copyright_type,
         'public_type': public_type,
         'watch_password': watch_password,
         'description': description,
         'thumbnail_seq': thumbnail_seq
     }
     data = remove_none_value(data)
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()['id']
コード例 #26
0
ファイル: youku_searches.py プロジェクト: nsdown/youku
 def search_show_top_unite(self, category, genre=None, area=None,
                           year=None, orderby=None, headnum=1,
                           tailnum=1, onesiteflag=None,
                           page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=86
     """
     url = 'https://openapi.youku.com/v2/searches/show/top_unite.json'
     params = {
         'client_id': self.client_id,
         'category': category,
         'genre': genre,
         'area': area,
         'year': year,
         'orderby': orderby,
         'headnum': headnum,
         'tailnum': tailnum,
         'onesiteflag': onesiteflag,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()