doc: http://open.youku.com/docs/doc?id=74
514075
def destroy_playlist(self, access_token, playlist_id):
        
        url = 'https://openapi.youku.com/v2/playlists/destroy.json'
        data = {
            'client_id': self.client_id,
            'access_token': access_token,
            'playlist_id': playlist_id
        }
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()['id']
825797
function curveRegisterInfoUpdate(){
    //レジスタ値の取得 複数取得は返り値がObject
    KMB.cmdReadRegister([KMMotorOneWebBLE.cmdReadRegister_COMMAND.curveType,KMMotorOneWebBLE.cmdReadRegister_COMMAND.acc,KMMotorOneWebBLE.cmdReadRegister_COMMAND.dec]).then(function(val){
        let str="";
        Object.keys(val).forEach(function(k){str+=k+":"+val[k]+" "});
        $("#curveRegisterInfo").text(str);
    }).catch(function(msg){
        console.log(msg);
    });
}
673826
def find_show_premium_by_ids(self, show_ids, page=1, count=20):
        
        url = 'https://openapi.youku.com/v2/shows/show_premium.json'
        params = {
            'client_id': self.client_id,
            'show_ids': show_ids,
            'page': page,
            'count': count
        }
        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()
535735
function() {
		var api_url,
			self = this;
					
		// Create Dom element
		this._el.content_item = TL.Dom.create("div", "tl-media-twitter", this._el.content);
		this._el.content_container.className = "tl-media-content-container tl-media-content-container-text";
        		
		// Get Media ID
        if(this.data.url.match("^(https?:)?\/*(www.)?twitter\.com"))
        {
		if (this.data.url.match("status\/")) {
			this.media_id = this.data.url.split("status\/")[1];
		} else if (this.data.url.match("statuses\/")) {
			this.media_id = this.data.url.split("statuses\/")[1];
		} else {
			this.media_id = "";
		}
        }
        
        else if(this.data.url.match("<blockquote class=['\"]twitter-tweet['\"]")) {
		
        var found = this.data.url.match(/(status|statuses)\/(\d+)/);
		if (found && found.length > 2) {
		    this.media_id = found[2];
		} else {
		    self.loadErrorDisplay(self._("twitterembed_invalidurl_err"));
		    return;
		}
    }
        
		// API URL
		api_url = "https://api.twitter.com/1/statuses/oembed.json?id=" + this.media_id + "&omit_script=true&include_entities=true&callback=?";
		
		// API Call
		TL.ajax({
			type: 'GET',
			url: api_url,
			dataType: 'json', //json data type
			success: function(d){
				self.createMedia(d);
			},
			error:function(xhr, type){
				var error_text = "";
				error_text += self._("twitter_load_err") + "<br/>" + self.media_id + "<br/>" + type;
				self.loadErrorDisplay(error_text);
			}
		});
		 
	}
411853
function showStreams() {
	//http://ibl.api.bbci.co.uk/ibl/v1/channels?lang=en&api_key=APIKEY
	var query = nitro.newQuery();
	query.add(ibl.commonLangEn);
	nitro.make_request(ibl.host,ibl.getChannels,ibl_key,query,{},function(obj){
		console.log(JSON.stringify(obj,null,2));
		for (var i in obj.channels) {
			var ch = obj.channels[i];
			console.log('['+ch.title+'](http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_tablet_rw/llnw/'+ch.master_brand_id+'.m3u8)');
		}
		return false;
	});
}
181844
function pGetUrl(url, headers){
    //console.log(`\r\n发起远程请求(${Date()})：${url}\r\n`);
    if(!headers){
        headers = {};
    }
    headers['User-Agent'] = 'Request-Promise';
    return rp({
        uri: url,
        headers: headers,
        json: true // Automatically parses the JSON string in the response
    });
}
1008370
def find_video_details_by_ids(self, video_ids, ext=None):
        
        url = 'https://openapi.youku.com/v2/videos/show_batch.json'
        params = {
            'client_id': self.client_id,
            'video_ids': video_ids
        }
        if ext:
            params['ext'] = ext
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
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()
80011
function local(backendTplServer) {
    backendTplServer.app.get('/news/local', function(request, response) {
        // 公共的数据模型可以抽取到出来, 作为一个文件 require 进来, 防止多处重复定义数据模型的规则
        var data = Mock.mock({
            'news|10-20': [news]
        });

        // 单独修改其中的某个数据
        data.news[0].getUrls = function() {
            return [
                'http://dummyimage.com/112x74,',
                'http://dummyimage.com/112x74,',
                'http://dummyimage.com/112x74,',
                'http://dummyimage.com/112x74,'
            ]
        };

        response.render('news/local.html', data);
    });
}
715516
def find_comments_by_video(self, video_id, page=1, count=20):
        
        url = 'https://openapi.youku.com/v2/comments/by_video.json'
        params = {
            'client_id': self.client_id,
            'video_id': video_id,
            'page': page,
            'count': count
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
1284196
def find_shows_by_ids(self, show_ids):
        
        url = 'https://openapi.youku.com/v2/shows/show_batch.json'
        params = {
            'client_id': self.client_id,
            'show_ids': show_ids
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
731680
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {

        eZMediaType::checkFileUploads();

        $classAttribute = $contentObjectAttribute->contentClassAttribute();
        $player = $classAttribute->attribute( "data_text1" );
        $pluginPage = eZMediaType::pluginPage( $player );

        $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
        $version = $contentObjectAttribute->attribute( "version" );
        $width = $http->postVariable( $base . "_data_media_width_" . $contentObjectAttribute->attribute( "id" ) );
        $height = $http->postVariable( $base . "_data_media_height_" . $contentObjectAttribute->attribute( "id" ) );
        $quality = $http->hasPostVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) : null;
        if ( $http->hasPostVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) ) )
            $controls = $http->postVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) );
        else
            $controls = null;

        $media = eZMedia::fetch( $contentObjectAttributeID, $version );
        if ( $media == null )
        {
           $media = eZMedia::create( $contentObjectAttributeID, $version );
        }

        $media->setAttribute( "contentobject_attribute_id", $contentObjectAttributeID );
        $media->setAttribute( "version", $version );
        $media->setAttribute( "width", $width );
        $media->setAttribute( "height", $height );
        $media->setAttribute( "quality", $quality );
        $media->setAttribute( "controls", $controls );
        $media->setAttribute( "pluginspage", $pluginPage );
        if ( $http->hasPostVariable( $base . "_data_media_is_autoplay_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_autoplay", true );
        else
            $media->setAttribute( "is_autoplay", false );
        if ( $http->hasPostVariable( $base . "_data_media_has_controller_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "has_controller", true );
        else
            $media->setAttribute( "has_controller", false );
        if ( $http->hasPostVariable( $base . "_data_media_is_loop_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_loop", true );
        else
            $media->setAttribute( "is_loop", false );

        $mediaFilePostVarName = $base . "_data_mediafilename_" . $contentObjectAttribute->attribute( "id" );
        if ( eZHTTPFile::canFetch( $mediaFilePostVarName ) )
            $mediaFile = eZHTTPFile::fetch( $mediaFilePostVarName );
        else
            $mediaFile = null;
        if ( $mediaFile instanceof eZHTTPFile )
        {
            $mimeData = eZMimeType::findByFileContents( $mediaFile->attribute( "original_filename" ) );
            $mime = $mimeData['name'];

            if ( $mime == '' )
            {
                $mime = $mediaFile->attribute( "mime_type" );
            }
            $extension = eZFile::suffix( $mediaFile->attribute( "original_filename" ) );
            $mediaFile->setMimeType( $mime );
            if ( !$mediaFile->store( "original", $extension ) )
            {
                eZDebug::writeError( "Failed to store http-file: " . $mediaFile->attribute( "original_filename" ),
                                     "eZMediaType" );
                return false;
            }

            $orig_dir = $mediaFile->storageDir( "original" );
            eZDebug::writeNotice( "dir=$orig_dir" );
            $media->setAttribute( "filename", basename( $mediaFile->attribute( "filename" ) ) );
            $media->setAttribute( "original_filename", $mediaFile->attribute( "original_filename" ) );
            $media->setAttribute( "mime_type", $mime );

            $filePath = $mediaFile->attribute( 'filename' );
            $fileHandler = eZClusterFileHandler::instance();
            $fileHandler->fileStore( $filePath, 'media', true, $mime );
        }
        else if ( $media->attribute( 'filename' ) == '' )
        {
            $media->remove();
            return false;
        }

        $media->store();
        $contentObjectAttribute->setContent( $media );
        return true;
    }
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()
128483
def fetcher(date=datetime.today(), url_pattern=URL_PATTERN):
    
    api_url = url_pattern % date.strftime('%Y-%m-%d')

    headers = {'Referer': 'http://n.pl/program-tv'}
    raw_result = requests.get(api_url, headers=headers).json()
    return raw_result
1287078
public static function preprocess($url_parsed) {

        // different path for different domain
        if (strtolower($url_parsed['host'])=='player.youku.com') {
            $regex = '/^\/player\.php\/sid\/([a-zA-Z0-9]+)(\=\/v\.swf|\/v\.swf)$/';
        } elseif (strtolower($url_parsed['host'])=='v.youku.com') {
            $regex = '/^\/v_show\/id_(.+?)(\=|)\.html/';
        }

        // match sid from path
        if (preg_match($regex, $url_parsed['path'], $matches) == 1) {
            return array(
                'sid' => $matches[1],
            );
        }

        return FALSE;
    }
966345
def find_show_by_id(self, show_id):
        
        url = 'https://openapi.youku.com/v2/shows/show.json'
        params = {
            'client_id': self.client_id,
            'show_id': show_id
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()