我刚才注意到,我们习惯使用的漫长而复杂的Facebook网址现在看起来像这样:
http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345
据我所知,今年早些时候它只是一个普通的URL片段式字符串(以...开头#),没有感叹号.但现在它是一个shebang或hashbang(#!),我以前只在shell脚本和Perl脚本中看到过.
在新的Twitter的网址,现在还采用了#!符号.例如,Twitter个人资料网址现在看起来像这样:
http://twitter.com/#!/BoltClock
#!现在是否在URL中起了一些特殊的作用,比如某个Ajax框架或某些东西,因为新的Facebook和Twitter界面现在基本上是Ajax化的?在我的URL中使用它会以任何方式使我的Web应用程序受益吗?
如果一张图片价值1000字,你可以在140个字符中放入多少图片?
注意:那就是大家!赏金的最后期限就在这里,经过一番艰难的考虑后,我认为Boojum的进入只是勉强淘汰Sam Hocevar的.一旦我有机会写出来,我会发布更详细的笔记.当然,每个人都应该随时继续提交解决方案并改进人们投票的解决方案.感谢所有提交和参赛的人; 我很喜欢他们.这对我来说非常有趣,我希望这对参赛者和观众来说都很有趣.
我遇到了一篇关于尝试将图像压缩成Twitter评论的有趣帖子,该线程中的很多人(以及Reddit上的一个帖子)都提出了有关不同方法的建议.所以,我认为这将是一个很好的编码挑战; 让人们将钱放在嘴边,并展示他们对编码的看法如何在有限的空间中提供更多细节.
我挑战你想出一个通用系统,用于将图像编码成140个字符的Twitter消息,并将它们再次解码为图像.您可以使用Unicode字符,因此每个字符的字符数超过8位.但是,即使允许使用Unicode字符,也需要将图像压缩到非常小的空间内; 这肯定会是一种有损压缩,因此必须对每种结果的好看进行主观判断.
以下是原作者Quasimondo从他的编码中获得的结果(图片根据知识共享署名 - 非商业许可证授权):

你能做得更好吗?
U+0000- U+10FFFF,排除非字符(U+FFFE,U+FFFF,U+ÑFFFE,U+ÑFFFF其中Ñ是1- 10十六进制和范围U+FDD0- U+FDEF)和替代代码点(U+D800- U+DFFF).它可以以您选择的任何合理编码输出; GNUiconv支持的任何编码都被认为是合理的,您的平台本机编码或区域编码可能是一个不错的选择.有关详细信息,请参阅下面的Unicode注释我一直在玩mongodb中的存储推文,每个对象看起来像这样:
{
"_id" : ObjectId("4c02c58de500fe1be1000005"),
"contributors" : null,
"text" : "Hello world",
"user" : {
"following" : null,
"followers_count" : 5,
"utc_offset" : null,
"location" : "",
"profile_text_color" : "000000",
"friends_count" : 11,
"profile_link_color" : "0000ff",
"verified" : false,
"protected" : false,
"url" : null,
"contributors_enabled" : false,
"created_at" : "Sun May 30 18:47:06 +0000 2010",
"geo_enabled" : false,
"profile_sidebar_border_color" : "87bc44",
"statuses_count" : 13,
"favourites_count" : 0,
"description" : "",
"notifications" : null,
"profile_background_tile" : false,
"lang" : "en", …Run Code Online (Sandbox Code Playgroud) 由于截至2013年6月11日的Twitter API 1.0退出,下面的脚本不再起作用.
// Create curl resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/myscreenname.json?count=10");
// Return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// Close curl resource to free up system resources
curl_close($ch);
if ($output)
{
$tweets = json_decode($output,true);
foreach ($tweets as $tweet)
{
print_r($tweet);
}
}
Run Code Online (Sandbox Code Playgroud)
如何以尽可能少的代码获取user_timeline(最近的状态)?
我发现了这个:https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline 但我收到以下错误:
"{"errors":[{"message":"Could not authenticate you","code":32}]}"
Run Code Online (Sandbox Code Playgroud)
有很多课程,但在尝试了几个之后,由于Twitter上的这些更新,它们中的任何一个似乎都不起作用,而且其中一些是非常高级的类,具有很多我不需要的功能.
使用PHP获取最近用户状态的最简单/最短方法是什么?
所以我通过OAuth从Twitter中提取XML
所以我正在向http://twitter.com/account/verify_credentials.xml提出请求
返回以下XML
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>16434938</id>
<name>Lloyd Sparkes</name>
<screen_name>lloydsparkes</screen_name>
<location>Hockley, Essex, UK</location>
<description>Student</description>
<profile_image_url>http://a3.twimg.com/profile_images/351849613/twitterProfilePhoto_normal.jpg</profile_image_url>
<url>http://www.lloydsparkes.co.uk</url>
<protected>false</protected>
<followers_count>115</followers_count>
<profile_background_color>9fdaf4</profile_background_color>
<profile_text_color>000000</profile_text_color>
<profile_link_color>220f7b</profile_link_color>
<profile_sidebar_fill_color>FFF7CC</profile_sidebar_fill_color>
<profile_sidebar_border_color>F2E195</profile_sidebar_border_color>
<friends_count>87</friends_count>
<created_at>Wed Sep 24 14:26:09 +0000 2008</created_at>
<favourites_count>0</favourites_count>
<utc_offset>0</utc_offset>
<time_zone>London</time_zone>
<profile_background_image_url>http://s.twimg.com/a/1255366924/images/themes/theme12/bg.gif</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<statuses_count>1965</statuses_count>
<notifications>false</notifications>
<geo_enabled>false</geo_enabled>
<verified>false</verified>
<following>false</following>
<status>
<created_at>Mon Oct 12 19:23:47 +0000 2009</created_at>
<id>4815268670</id>
<text>» @alexmuller your kidding? it should all be "black tie" dress code</text>
<source><a href="http://code.google.com/p/wittytwitter/" rel="nofollow">Witty</a></source>
<truncated>false</truncated>
<in_reply_to_status_id>4815131457</in_reply_to_status_id>
<in_reply_to_user_id>8645442</in_reply_to_user_id>
<favorited>false</favorited>
<in_reply_to_screen_name>alexmuller</in_reply_to_screen_name>
<geo/>
</status>
</user>
Run Code Online (Sandbox Code Playgroud)
我使用以下代码来反序列化
public User VerifyCredentials()
{
string …Run Code Online (Sandbox Code Playgroud) 我尝试在我的Mac上安装twitter bower,我用过
npm install bower -g
Run Code Online (Sandbox Code Playgroud)
然后我尝试了bower --help,输出是bower command not found.这是为什么?
我正在开发一个我希望使用OAuth的Twitter项目,但我不知道从哪里获取消费者和密钥.
我怎么能得到这些?
是否有其他人难以获得Twitters oAuth的回调URL以访问他们的localhost开发环境.显然它最近被禁用了.http://code.google.com/p/twitter-api/issues/detail?id=534#c1
有没有人有解决方法.我真的不想阻止我的发展
我试图跟随Twitter的API来获取用户的关注者列表.
http://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=username
我收到此错误消息作为回应.
{
code = 215;
message = "Bad Authentication data";
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法找到与此错误代码相关的文档.有人对这个错误有任何想法吗?
我正在尝试在电子邮件中添加Twitter共享链接.因为这是在电子邮件中我不能依赖JavaScript,并且必须使用"Build Your Own"Tweet按钮.
例如,分享指向Google的链接:
<a href="http://www.twitter.com/share?url=http://www.google.com/>Tweet</a>
Run Code Online (Sandbox Code Playgroud)
这很好用.我遇到的问题是URL有查询字符串.
<a href="http://www.twitter.com/share?url=http://mysite.org/foo.htm?bar=123&baz=456">Tweet</a>
Run Code Online (Sandbox Code Playgroud)
带有查询字符串的网址混淆了Twitter的网址缩短服务,t.co. 我已经尝试过以各种方式对此进行URL编码,并且无法正常工作.我得到的最接近的是这样做.
<a href="http://www.twitter.com/share?url=http://mysite.org/foo.htm%3Fbar%3D123%26baz%3D456">Tweet</a>
Run Code Online (Sandbox Code Playgroud)
这里我只编码了查询字符串.当我这样做时,t.co成功地缩短了URL,但是在遵循缩短的链接时,它会将您带到编码的URL.我http://mysite.org/foo.htm%3Fbar%3D123%26baz%3D456在地址栏中看到,并在浏览器中收到以下错误
未找到
在此服务器上找不到请求的URL /foo.htm?bar=123&baz=456.
我不知道如何解决这个问题.
编辑: Re:onteria_
我试过编码整个网址.当我这样做时,Tweet中没有显示任何URL.