doc: http://open.youku.com/docs/doc?id=83
15007
def search_keyword_complete(self, keyword):
        
        url = 'https://openapi.youku.com/v2/searches/keyword/complete.json'
        params = {
            'client_id': self.client_id,
            'keyword': keyword
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
194402
def find_next_video_in_playlist(self, playlist_id, cur_video_id):
        
        url = 'https://openapi.youku.com/v2/playlists/video/next.json'
        params = {
            'client_id': self.client_id,
            'playlist_id': playlist_id,
            'video_id': cur_video_id
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
250919
def subscribe_notice(self, access_token):
        
        url = 'https://openapi.youku.com/v2/users/subscribe/notice.json'
        params = {
            'client_id': self.client_id,
            'access_token': access_token
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
955973
def docomo_openiarea_url_for(options = {})
      url = options
      if options.is_a?(Hash)
        options = options.symbolize_keys
        options[:only_path] = false
        posinfo = options.delete(:posinfo) || '1' # 基地局情報を元に測位した緯度経度情報を要求
        url = url_for(options)
      else
        posinfo = '1'
      end
      "http://w1m.docomo.ne.jp/cp/iarea?ecode=OPENAREACODE&msn=OPENAREAKEY&posinfo=#{posinfo}&nl=#{CGI.escape(url)}"
    end
947265
def find_videos_by_related(self, video_id, count=20):
        
        url = 'https://openapi.youku.com/v2/videos/by_related.json'
        params = {
            'client_id': self.client_id,
            'video_id': video_id,
            'count': count
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
712108
def create_favorite_video(self, access_token, video_id):
        
        url = 'https://openapi.youku.com/v2/videos/favorite/create.json'
        data = {
            'client_id': self.client_id,
            'access_token': access_token,
            'video_id': video_id
        }
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()['id']
956192
def get_token_by_code(self, code):
        ''''''
        url = 'https://openapi.youku.com/v2/oauth2/token'
        data = {'client_id': self.client_id,
                'client_secret': self.client_secret,
                'grant_type': 'authorization_code',
                'code': code,
                'redirect_uri': self.redirect_uri}
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()
929449
def lookup(
        db,
        aid: int,
        fields: FieldsParam = ALL,
        episode_fields: FieldsParam = (),
) -> Anime:
    
    return next(select(
        db,
        'aid=?',
        (aid,),
        fields=fields,
        episode_fields=episode_fields,
    ))
458541
def find_favorite_videos_by_userid(self, user_id,
                                       orderby='favorite-time',
                                       page=1, count=20):
        
        url = 'https://openapi.youku.com/v2/videos/favorite/by_user.json'
        params = {
            'client_id': self.client_id,
            'user_id': user_id,
            'orderby': orderby,
            'page': page,
            'count': count
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
1335905
def random
      require 'open-uri'
      require 'nokogiri'

      @main_page_doc = Nokogiri::HTML(open('https://thecodinglove.com'))
      random_love_page_url = @main_page_doc.at_xpath("//a[@class='nav-link']/@href").to_s

      text, image_url = atUrl(random_love_page_url)

      markdown("------\n#{text}\n--\n![alt text](#{image_url} \"thecodinglove.com\")")

      [text, image_url]
    end
1317579
public function updateNews($news_media_id) {
		$newsMedia = WechatNewsMedia::findOne($news_media_id);
		if(!$newsMedia) {
			throw new ErrorException('数据查询失败');
		}

		if($newsMedia->news->count_item == count($newsMedia->thumbMaterialMediaIdList)) {
			$articles = $media->news->getArticles($this);
			$thumb_material_media_ids = [];
			$success = true;
			foreach($articles as $index => $article) {
				$thumb_material_media_ids[] = $article['thumb_material_media_id'];
				$data = $this->getData('/cgi-bin/material/update_news', [
					'access_token' => $this->getAccessToken(),
				], Json::encode([
					'media_id' => $media->media_id,
					'index' => $index,
					'articles' => $article,
				]));
				if($this->errcode != 0) {
					$success = false;
					break;
				}
			}
			if($success) {
				$media->thumb_material_media_ids = Json::encode($thumb_material_media_ids);
				if($details = $this->getNews($media->media_id)) {
					$media->urls = Json::encode(ArrayHelper::getColumn($details['news_item'], 'url'));
					$media->thumb_urls = Json::encode(ArrayHelper::getColumn($details['news_item'], 'thumb_url'));
				}
				if($media->save()) {
					return $media->id;
				}
			}
		} else {
			$newsid = $media->newsid;
			if($this->deleteNews($media->id)) {
				return $this->addNews($newsid);
			}
		}

		return 0;
	}
848469
function(){
		/* URLの種類からURLを取得する */
		var domain = (!pzpr.env.node ? document.domain : ''), url = "", pid = this.pid;
		if(!!domain){ domain += location.pathname;}
		else{ domain = "pzv.jp/p.html";}
		switch(this.type){
			case URL_PZPRV3:  url="http://"+domain+"?%PID%/"; break;
			case URL_KANPEN:  url="http://www.kanpen.net/%KID%.html?problem="; break;
			case URL_KANPENP: url="http://www.kanpen.net/%KID%.html?pzpr="; break;
			case URL_HEYAAPP: url="http://www.geocities.co.jp/heyawake/?problem="; break;
		}

		return url.replace("%PID%", pzpr.variety(pid).urlid)
				  .replace("%KID%", pzpr.variety(pid).kanpenid);
	}
1135148
function showCategories() {
	//http://ibl.api.bbci.co.uk/ibl/v1/categories?lang=en&api_key=APIKEY
	//http://ibl.api.bbci.co.uk/ibl/v1/categories/drama-and-soaps?lang=en&api_key=APIKEY
	//http://www.bbc.co.uk/iplayer/js/categories.json
	var query = nitro.newQuery();
	query.add(ibl.commonLangEn);
	nitro.make_request(ibl.host,ibl.getCategories,ibl_key,query,{},function(obj){
		console.log();
		for (var i in obj.categories) {
			var cat = obj.categories[i];
			console.log(cat.id+' '+cat.title+' '+cat.kind);
			var sQuery = nitro.newQuery();
			sQuery.add(ibl.commonLangEn);
			//console.log(cat);
			nitro.make_request(ibl.host,ibl.getCategories2(cat.id),ibl_key,sQuery,{},function(obj){
				for (var sc in obj.category.sub_categories) {
					var subcat = obj.category.sub_categories[sc];
					console.log('  '+subcat.id+' '+subcat.contextual_title+' '+subcat.kind+' '+subcat.child_programme_count+'>'+subcat.child_episode_count);
					if (subcat.sub_categories.length>0) {
						console.log(JSON.stringify(subcat.sub_categories,null,2));
					}
				}
			});
		}
		return false;
	});
}
353170
def find_persons_by_ids(self, person_ids):
        
        url = 'https://openapi.youku.com/v2/persons/show_batch.json'
        params = {
            'client_id': self.client_id,
            'person_ids': person_ids
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
1081263
function(){
		var inp = this.qdata.split("/"), col = 0, row = 0;
		delete this.qdata;
		/* URLにつけるオプション */
		if(this.type!==URL_KANPEN && this.type!==URL_HEYAAPP){
			if(!!inp[0] && !isNaN(inp[0])){ inp.unshift("");}
			this.pflag = inp.shift();
		}
		
		/* サイズを表す文字列 */
		if(this.type===URL_KANPEN){
			if(this.pid==="kakuro"){
				row = +inp.shift() - 1;
				col = +inp.shift() - 1;
			}
			else if(this.pid==="sudoku"){
				row = col = +inp.shift();
			}
			else{
				row = +inp.shift();
				col = +inp.shift();
			}
		}
		else if(this.type===URL_HEYAAPP){
			var size = inp.shift().split("x");
			col = +size[0];
			row = +size[1];
		}
		else{
			col = +inp.shift() || NaN;
			row = +inp.shift() || NaN;
		}
		this.rows = row;
		this.cols = col;

		/* サイズ以降のデータを取得 */
		if(!inp[inp.length-1]){ inp.pop();}
		this.body = inp.join("/");
	}
1311685
def find_comments_by_ids(self, comment_ids):
        
        url = 'https://openapi.youku.com/v2/comments/show_batch.json'
        params = {
            'client_id': self.client_id,
            'comment_ids': comment_ids
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
143710
def show_category(self):
        
        url = 'https://openapi.youku.com/v2/schemas/show/category.json'
        r = requests.get(url)
        check_error(r)
        return r.json()