doc: http://open.youku.com/docs/doc?id=62
559427
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):
        
        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()
467526
function getVideoIdYoutube (str) {
  // link : https://youtube.com/watch?v=HBHJ0XGZfLs
  // share : https://youtu.be/HBHJ0XGZfLs
  // embed : https://youtube.com/embed/HBHJ0XGZfLs
  var re = /\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i
  var matches = re.exec(str)
  return matches && matches[1]
}
267569
def comment_expression(self):
        
        url = 'https://openapi.youku.com/v2/schemas/comment/expression.json'
        r = requests.get(url)
        check_error(r)
        return r.json()
836392
def destroy_comment(self, access_token, comment_id):
        
        url = 'https://openapi.youku.com/v2/comments/destroy.json'
        data = {
            'client_id': self.client_id,
            'access_token': access_token,
            'comment_id': comment_id
        }
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()['id']
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
555965
def find_playlists_by_ids(self, playlist_ids):
        
        url = 'https://openapi.youku.com/v2/playlists/show_batch.json'
        params = {
            'client_id': self.client_id,
            'playlist_ids': playlist_ids
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
415941
function(){
		/* ヘッダの処理 */
		if(this.type===FILE_PZPR){
			return [(this.filever===0?"pzprv3":("pzprv3." + this.filever)), this.pid, ""].join("\n");
		}
		else if(this.type===FILE_PBOX_XML){
			this.body.querySelector('puzzle').setAttribute('type', pzpr.variety(this.pid).kanpenid);
		}
		return "";
	}
776068
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):
        
        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']
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
323373
def get_url(self, agent_id, media_id):
        
        parts = (
            'https://qyapi.weixin.qq.com/cgi-bin/material/get',
            '?access_token=',
            self.access_token,
            '&media_id=',
            media_id,
            '&agentid=',
            agent_id,
        )
        return ''.join(parts)
305384
function () {

/*Line 44 - 'AtomForm.js' */                if (!this.isValid()) {
/*Line 45 - 'AtomForm.js' */                    return;
/*Line 46 - 'AtomForm.js' */                }

/*Line 48 - 'AtomForm.js' */                var data = this.preparePostData();
/*Line 49 - 'AtomForm.js' */                var url = AtomPromise.getUrl(this._postUrl);
/*Line 50 - 'AtomForm.js' */                AtomPromise.json(url, { _tv: Atom.time() }, { type: "POST", data: data }).then(this._success).invoke();
/*Line 51 - 'AtomForm.js' */            }
86214
def find_video_by_url(self, video_url):
        
        url = 'https://openapi.youku.com/v2/videos/show_basic.json'
        params = {
            'client_id': self.client_id,
            'video_url': video_url
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
415898
def closed(self, reason):
        '''
        
        '''
        # 拷贝封面&报头图片文件
        utils.mkdirp(os.path.join(self.build_source_dir, 'images'))
        self._logger.info(self.options)
        shutil.copy(
            self.options.get('img_cover'),
            os.path.join(self.build_source_dir, 'images', 'cover.jpg'))
        shutil.copy(
            self.options.get('img_masthead'),
            os.path.join(self.build_source_dir, 'images', 'masthead.gif'))

        # 拷贝css文件
        css_base_path = self.options.get('css_base')
        css_package_path = self.options.get('css_package')
        css_extra = self.options.get('extra_css', '')
        css_output_dir = os.path.join(self.build_source_dir, 'css')
        utils.mkdirp(css_output_dir)
        if css_base_path:
            shutil.copy(
                css_base_path,
                os.path.join(css_output_dir, 'base.css'))
        if css_package_path:
            shutil.copy(
                css_package_path,
                os.path.join(css_output_dir, 'package.css'))
        if css_extra:
            with codecs.open(
                    os.path.join(css_output_dir, 'custom.css'),
                    'wb', 'utf-8') as fh:
                fh.write(css_extra)

        # 拷贝icons路径文件
        icons_path = self.options.get('icons_path')
        icons_output_dir = os.path.join(self.build_source_dir, 'icons')
        shutil.rmtree(icons_output_dir, ignore_errors=True)
        if icons_path:
            shutil.copytree(icons_path, icons_output_dir)

        # 获取content模板对象
        template_content_path = os.path.join(
            self.template_dir, 'OEBPS', 'content.opf')
        with open(template_content_path, 'r') as fh:
            template_content = Template(fh.read())

        # 渲染content目标文件
        content_path = os.path.join(self.build_source_dir, 'moear.opf')
        with codecs.open(content_path, 'wb', 'utf-8') as fh:
            fh.write(template_content.render(
                data=self.data,
                spider=self.spider,
                options=self.options))

        # 获取toc.ncx模板对象
        template_toc_path = os.path.join(
            self.template_dir, 'OEBPS', 'toc.ncx')
        with open(template_toc_path, 'r') as fh:
            template_toc = Template(fh.read())

        # 渲染toc.ncx目标文件
        toc_path = os.path.join(self.build_source_dir, 'misc', 'toc.ncx')
        utils.mkdirp(os.path.dirname(toc_path))
        with codecs.open(toc_path, 'wb', 'utf-8') as fh:
            fh.write(template_toc.render(
                data=self.data,
                spider=self.spider,
                options=self.options))

        # 获取toc.html模板对象
        template_toc_path = os.path.join(
            self.template_dir, 'OEBPS', 'toc.html')
        with open(template_toc_path, 'r') as fh:
            template_toc = Template(fh.read())

        # 渲染toc.html目标文件
        toc_path = os.path.join(self.build_source_dir, 'html', 'toc.html')
        utils.mkdirp(os.path.dirname(toc_path))
        with codecs.open(toc_path, 'wb', 'utf-8') as fh:
            fh.write(template_toc.render(
                data=self.data,
                options=self.options))

        # 生成mobi文件到mobi_dir
        self.generate_mobi_file()
432954
def search_keyword_top(self, category=None, count=20, period='today'):
        
        url = 'https://openapi.youku.com/v2/searches/keyword/top.json'
        params = {
            'client_id': self.client_id,
            'count': count,
            'period': period
        }
        if category:
            params['category'] = category
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
441965
function getYTVideoID(url) {
      var regexp = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i;
      var match = url.match(regexp);
      return match && match.length === 2 ? match[1] : false;
    }
152357
def searche_top_category(self):
        
        url = 'https://openapi.youku.com/v2/schemas/searche/top/category.json'
        r = requests.get(url)
        check_error(r)
        return r.json()
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()