一个命令行和编程接口,可以连接到各种社会共享计数端点。

socialshares的Python项目详细描述


Build Status

访问社交共享的命令行实用程序和python库 对特定URL计数。

注意:很遗憾,此实用程序不再用于获取 tweet和retweet很重要,因为twitter已经删除了这个api 依赖的功能。Facebook和其他平台仍然有效。

用法

Usage:
  socialshares <url> [<platforms>...] [options]

Options:
  -h, --help  Show this screen.
  -p, --plain  Plain output.
  -r <attempts>, --retry <attempts>  Retry fetching up to <attempt> times [default: 1]
  -e, --exit  Exit with an error code when not all counts could be fetched.

一些示例:

# fetch count for all supported platforms,
# try again once (the default) for platforms that fail
$ socialshares http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

# fetch only facebook
$ socialshares http://www.theguardian.com/politics facebook     --retry 2

支持的平台

PlatformDescription
facebookfacebook shares and comments
linkedinlinkedin shares
googlegoogle +1’s
pinterestpinterest pins
redditreddit ups and downs (summed across posts)

平台并行获取并重试(默认为一次)。如果没有 指定平台,只返回facebook和twitter。

不支持的平台

不幸的是,下面的API不再存在,并且已被删除 从界面。

PlatformDescription
twittertwitter tweets and retweets containing the URL
facebookfqlfacebook likes, shares and comments

输出

默认情况下,socialsharesoutputs json:

{"reddit":{"downs":0,"ups":6},"google":20,"facebook":1498,"twitter":300,"pinterest":1}

如果希望使用空格分隔的输出,请使用--plain标志。

$ socialshares http://www.theguardian.com/politics twitter
57

来自python的用法

importsocialsharescounts=socialshares.fetch(url,['facebook','pinterest'])

安装

pip install socialshares
# optionally, for asynchronous fetching
pip install grequests

如果requests_futures和 (对于python 2.x)futures 如果已安装,social-shares将使用这些软件包加速 通过访问 平行的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用prepared语句在oracle中插入日期   对点具有双重值的java   使用多个通配符的java请求映射   java Springboot为什么要设置springbootstartertomcat   除了对JavaBean的请求之外,还使用servletContext的servlet   java如何清除OCSID。返回到池的连接时的CLIENTID JDBC客户端信息属性   将整型数组转换为光栅Java   java使用对象引用作为互斥锁   java为什么在编程语言中使用sin函数返回奇怪的sin值不像计算器   java如何将JButton链接到对象并调用相关方法   php用Java发送POST数据   导航属性的java模拟加载   java多个活动错误Android试图对空对象引用调用虚拟方法“”   java Android更改ActionBar文本颜色   如何使用带有java反射且不带开关的parant引用创建子类