Skip to content

Instantly share code, notes, and snippets.

@yesmeck
Created September 20, 2012 18:03
Show Gist options
  • Save yesmeck/3757415 to your computer and use it in GitHub Desktop.
Save yesmeck/3757415 to your computer and use it in GitHub Desktop.
douban movie reviews api
% http --form POST https://api.douban.com/v2/movie/reviews Authorization:"Bearer a427972a77c120c4e576c57f6743624c" movie=07931 title=测试 content="因为,绳命,是剁么的回晃;绳命,是入刺的井猜。壤窝们,巩痛嘱咐碰优。田下冯广宰饿妹,饿妹冯广宰呲呲处。壤窝们,嘱咐这缩优类缩优。开心的一小,火大的一小,壤绳命,梗楤容,壤绳命,梗秤巩,壤绳命,梗回晃。" rating=5 -v
POST /v2/movie/reviews HTTP/1.1
Accept-Encoding: identity, deflate, compress, gzip
Accept: */*
User-Agent: HTTPie/0.2.7
Host: api.douban.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Authorization: Bearer a427972a77c320c4ec76c57f6743624c
movie=1307931&title=%E6%B5%8B%E8%AF%95&content=%E5%9B%A0%E4%B8%BA%EF%BC%8C%E7%BB%B3%E5%91%BD%EF%BC%8C%E6%98%AF%E5%89%81%E4%B9%88%E7%9A%84%E5%9B%9E%E6%99%83%EF%BC%9B%E7%BB%B3%E5%91%BD%EF%BC%8C%E6%98%AF%E5%85%A5%E5%88%BA%E7%9A%84%E4%BA%95%E7%8C%9C%E3%80%82%E5%A3%A4%E7%AA%9D%E4%BB%AC%EF%BC%8C%E5%B7%A9%E7%97%9B%E5%98%B1%E5%92%90%E7%A2%B0%E4%BC%98%E3%80%82%E7%94%B0%E4%B8%8B%E5%86%AF%E5%B9%BF%E5%AE%B0%E9%A5%BF%E5%A6%B9%EF%BC%8C%E9%A5%BF%E5%A6%B9%E5%86%AF%E5%B9%BF%E5%AE%B0%E5%91%B2%E5%A4%84%E3%80%82%E5%A3%A4%E7%AA%9D%E4%BB%AC%EF%BC%8C%E5%98%B1%E5%92%90%E8%BF%99%E7%BC%A9%E4%BC%98%E7%B1%BB%E7%BC%A9%E4%BC%98%E3%80%82%E5%BC%80%E5%BF%83%E7%9A%84%E4%B8%80%E5%B0%8F%EF%BC%8C%E7%81%AB%E5%A4%A7%E7%9A%84%E4%B8%80%E5%B0%8F%EF%BC%8C%E5%A3%A4%E7%BB%B3%E5%91%BD%EF%BC%8C%E6%A2%97%E6%A5%A4%E5%AE%B9%EF%BC%8C%E5%A3%A4%E7%BB%B3%E5%91%BD%EF%BC%8C%E6%A2%97%E7%A7%A4%E5%B7%A9%EF%BC%8C%E5%A3%A4%E7%BB%B3%E5%91%BD%EF%BC%8C%E6%A2%97%E5%9B%9E%E6%99%83%E3%80%82&rating=5
HTTP/1.1 500 Internal Server Error
Server: nginx
Content-Type: text/html
Content-Length: 4070
Connection: keep-alive
Keep-Alive: timeout=10
Content-Encoding: gzip
Date: Sat, 22 Sep 2012 05:37:49 GMT
Expires: -1
<!DOCTYPE html>
<html lang="zh-CN" class="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>豆瓣错误</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="Sun, 6 Mar 2005 01:00:00 GMT">
<script type="text/javascript">var _head_start=new Date();</script>
<script src="https://img0.douban.com/js/packed_jquery.min6301986802.js"></script><script src="https://img0.douban.com/js/packed_douban7786199553.js"></script><script src="https://img0.douban.com/js/separation/packed__all295341955.js"></script><script src="https://img0.douban.com/js/ui/packed_dialog429925323.js"></script><link href="https://img0.douban.com/css/packed_douban6963692293.css" rel="stylesheet" type="text/css"><link href="https://img0.douban.com/css/separation/packed__all3258846712.css" rel="stylesheet" type="text/css"><link href="https://img0.douban.com/css/ui/packed_dialog4563741467.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://img0.douban.com/js/lib/packed_jquery.form5689674177.js">
</script>
<script type="text/javascript">/*<![CDATA[*/
$(document).ready(function() {
var options = {
clearForm: true,
beforeSubmit: validateForm,
success: showResponse
}
$("#show_input").toggle(function() {
$("#error_input").slideDown();
}, function(){
$("#error_input").slideUp();
});
$("#error_input form").ajaxForm(options);
});
function validateForm() {
var $email = $('#exception input[name="email"]');
if (!$email[0]) return true;
var pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
$('.attn').remove();
if (trim($email.val()) == "") {
$email.after('<span class="attn">请填写Email地址</span>');
return false;
} else if (!pattern.test($email.val())) {
$email.after('<span class="attn">请填写合法的Email地址</span>');
return false;
}
return true;
}
function showResponse() {
$("#error_input").parent().find("li:eq(1)").slideUp();
$("#error_input").slideUp().after('<li style="list-style:none;color:#666;" id="tip">提交成功!我们会尽快处理,谢谢。</li>');
$("#tip").after('<li style="list-style-type:none; list-style-image:none; list-style-position:outside; color:#666;">&nbsp;</li><li style="list-style-type:none; list-style-image:none; list-style-position:outside; color:#666;">> 去<a href="/">豆瓣首页</a>瞧瞧。</li>');
setTimeout(function() {
$("#tip").yellow_fade()
}, 500);
}
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
/*]]>*/</script><link rel="shortcut icon" href="http://img3.douban.com/favicon.ico" type="image/x-icon">
<!-- COLLECTED CSS -->
</head>
<body>
<script type="text/javascript">var _body_start=new Date();</script>
<div class="top-nav">
<div class="bd">
<div class="top-nav-info">
<!-- _performtips_ -->
<a href="http://www.douban.com/doumail/">豆邮</a>
<a target="_blank" href="http://www.douban.com/accounts/">彼得潘的帐号</a>
<a href="http://www.douban.com/accounts/logout?ck=None">退出</a>
</div>
<div class="top-nav-items">
<ul>
<li class="on">
<a href="http://www.douban.com/">豆瓣社区</a>
</li>
<li>
<a href="http://book.douban.com/">豆瓣读书</a>
</li>
<li>
<a href="http://movie.douban.com/">豆瓣电影</a>
</li>
<li>
<a href="http://music.douban.com/">豆瓣音乐</a>
</li>
<li>
<a href="http://www.douban.com/location/">豆瓣同城</a>
</li>
<li>
<a href="http://douban.fm/" target="_blank">豆瓣FM</a>
</li>
<li class="top-nav-more">
<div class="top-nav-more-items">
<a href="#more" class="more">更多 <span class="arrow">&nbsp;</span>&nbsp;</a>
<ul>
<li><a href="http://9.douban.com" target="_blank">九点</a></li>
<li><a href="http://alphatown.com" target="_blank">阿尔法城</a></li>
<li><a href="http://www.douban.com/mobile/" target="_blank">移动应用</a></li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="wrapper">
<div id="header">
<div id="db-nav-main" class="site-nav">
<div class="site-nav-logo">
<a href="http://www.douban.com"><img src="http://img1.douban.com/pics/nav/lg_main_a10.png" alt="豆瓣"></a>
</div>
<div class="bd">
<div class="nav-srh">
<form name="ssform" method="get" action="http://www.douban.com/search">
<div class="inp">
<span><input id="search_text" name="search_text" type="text" title="成员、小组、音乐人、主办方" size="22" maxlength="60" value=""/></span>
<span><input class="bn-srh" type="submit" value="搜索"/></span>
</div>
</form>
</div>
<div class="site-nav-items nav-logged-in">
<ul>
<li><a href="http://www.douban.com/">首页</a></li>
<li><a href="http://www.douban.com/update/">友邻广播</a></li>
<li><a href="http://www.douban.com/mine/">我的豆瓣</a></li>
<li><a href="http://www.douban.com/group/">小组</a>
</li>
<li><a href="http://www.douban.com/site/">小站</a></li>
<li style="position:relative;"><a href="http://www.douban.com/tribe/">部落</a><img style="top:6px;left:2.2em;position:absolute;" src="http://img3.douban.com/pics/new_menu.gif"></li>
</ul>
</div>
</div>
<div class="ext"></div>
</div>
</div>
<div id="exception" style="margin:100px auto; width:350px;">
<img style="float:left;" src="http://img3.douban.com/pics/douban_error.gif"/>
<ul style="margin-left:40px; list-style-type:none; list-style-image:
none; list-style-position:outside;">
<li style="list-style-type:none; list-style-image:none;
list-style-position:outside; font-size:14px; line-height:
32px;">很抱歉,豆瓣出错了</li>
<li style="list-style-type:none; list-style-image:none;
list-style-position:outside; color:#666">你可以<a href="/help/ask"
id="show_input">点这里</a>向我们报错,协助豆瓣改进。(或者去<a
href='http://www.douban.com/'>豆瓣首页</a>)</li>
<li style="display:none;" id="error_input">
<form method="post" action="/help/ask"><div style="display:none;"><input type="hidden" name="ck" value="nKjK"/></div>
<h4 style="color:#368332; background:none;
margin:5px 0 0 0; width:301px;">简单描述:</h4>
<textarea cols="40" rows="5" name="title"
style="margin:0 0 5px 0; font-size:12px;"></textarea>
<br/>
<input type="submit" name="submit" value="提交"
style="color:#000; margin-top: 3px; cursor:pointer;"/>
<input type="hidden" name="type" value="94"/>
<input type="hidden" name="error_info"
value="
访问的URL:api.douban.com/v2/movie/reviews
出错时间:2012-09-22 13:37:49
出错信息:&lt;type 'exceptions.AttributeError'&gt;: 'NoneType' object has no attribute 'subject_entry'"/>
</form></li>
</ul>
</div>
<style type="text/css">
#exception form textarea { color:#999; }
#exception form textarea:focus { color:#333; }
#exception form input { color:#999; }
#exception form input:focus { color:#333; }
</style>
<div id="footer">
<span id="icp" class="fleft gray-link">&copy; 2005-2012 douban.com, all rights reserved
</span>
<span class="fright">
<a href="http://www.douban.com/about">关于豆瓣</a>
· <a href="http://www.douban.com/jobs">在豆瓣工作</a>
· <a href="http://www.douban.com/about?topic=contactus">联系我们</a>
· <a href="http://www.douban.com/about?policy=disclaimer">免责声明</a>
· <a href="http://www.douban.com/help/">帮助中心</a>
· <a href="http://developers.douban.com">开发者</a>
· <a href="http://www.douban.com/mobile/">手机豆瓣</a>
· <a href="http://www.douban.com/partner/">豆瓣广告</a>
</span>
</div>
</div><!-- COLLECTED JS -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7019765-1']);
_gaq.push(['_addOrganic', 'baidu', 'word']);
_gaq.push(['_addOrganic', 'soso', 'w']);
_gaq.push(['_addOrganic', '3721', 'name']);
_gaq.push(['_addOrganic', 'yodao', 'q']);
_gaq.push(['_addOrganic', 'vnet', 'kw']);
_gaq.push(['_addOrganic', 'sogou', 'query']);
_gaq.push(['_addIgnoredOrganic', '豆瓣']);
_gaq.push(['_addIgnoredOrganic', 'douban']);
_gaq.push(['_addIgnoredOrganic', '豆瓣网']);
_gaq.push(['_addIgnoredOrganic', 'www.douban.com']);
_gaq.push(['_setDomainName', '.douban.com']);
_gaq.push(['_trackPageview', '']);
_gaq.push(['_trackPageLoadTime']);
_gaq.push(['_setVar', '140']);
if (typeof(_letv) == "string") {
_gaq.push(['_trackEvent', 'LetvUrl', 'view', _letv, 1]);
}
if (typeof(_qiyi) == "string") {
_gaq.push(['_trackEvent', 'QiyiUrl', 'view', _qiyi, 1]);
}
if (typeof(_sohuhd) == "string") {
_gaq.push(['_trackEvent', 'SohuHdUrl', 'view', _sohuhd, 1]);
}
if (typeof(_youku) == "string") {
_gaq.push(['_trackEvent', 'YoukuUrl', 'view', _youku, 1]);
}
if (typeof(_tudou) == "string") {
_gaq.push(['_trackEvent', 'TudouUrl', 'view', _tudou, 1]);
}
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
</script>
<script src="http://img3.douban.com/js/boomerang.js?09" type="text/javascript"></script>
<script type="text/javascript">
BOOMR.init({
user_ip: "${request.ip}",
beacon_url: "/beacon.gif",
site_domain: ".douban.com",
BW: {
enabled: false
}
});
BOOMR.subscribe('before_beacon', function(o) {
if(o.t_done && o.t_done > 0 && o.t_done < 30) {
_gaq.push(['t1._trackEvent', 'Performance', 'done', '/service/api/v-/movie/reviews', o.t_done]);
}
});
var _now = new Date();
if (typeof(_head_start)==typeof(_now)) {
var t_head = _now-_head_start;
var t_body = _now-_body_start;
if (t_head < 60*1000 && t_head > 0) {
var _slow = t_head > 10*1000 ? 'slow ' : '';
_gaq.push(['t1._trackEvent', 'Performance', _slow + 'head', '/service/api/v-/movie/reviews', _now-_head_start]);
_gaq.push(['t1._trackEvent', 'Performance', _slow + 'body', '/service/api/v-/movie/reviews', _now-_body_start]);
}
}
</script>
<!-- hogg6 --><script>var _check_hijack = function () {
var _sig = "SE9KTLL/", _login = true, bid = get_cookie('bid');
if (location.protocol != "file:" && (typeof(bid) != "string" && _login || typeof(bid) == "string" && bid.substring(0,8) != _sig)) {
location.href+=(/\?/.test(location.href)?"&":"?") + "_r=" + Math.random().toString(16).substring(2);
}};
if (typeof(Do) != 'undefined') Do(_check_hijack);
else if (typeof(get_cookie) != 'undefined') _check_hijack();
</script></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment