socialcount

Compute social media strength of a URL

License

License

GroupId

GroupId

com.sangupta
ArtifactId

ArtifactId

socialcount
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

socialcount
Compute social media strength of a URL
Project URL

Project URL

http://sangupta.com/projects/socialcount
Source Code Management

Source Code Management

https://github.com/sangupta/socialcount

Download socialcount

How to add to project

<!-- https://jarcasting.com/artifacts/com.sangupta/socialcount/ -->
<dependency>
    <groupId>com.sangupta</groupId>
    <artifactId>socialcount</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.sangupta/socialcount/
implementation 'com.sangupta:socialcount:1.0.0'
// https://jarcasting.com/artifacts/com.sangupta/socialcount/
implementation ("com.sangupta:socialcount:1.0.0")
'com.sangupta:socialcount:jar:1.0.0'
<dependency org="com.sangupta" name="socialcount" rev="1.0.0">
  <artifact name="socialcount" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sangupta', module='socialcount', version='1.0.0')
)
libraryDependencies += "com.sangupta" % "socialcount" % "1.0.0"
[com.sangupta/socialcount "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.sangupta : jerry-http jar 0.9.0
com.google.code.gson : gson jar 2.2.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

Social Count

socialcount is a simple JAVA library to fetch various social like/share/comment counts for a given URL. This helps in analyzing the current outreach of a given URL.

The following social media providers are currently integrated:

  • Facebook likes, shares, comments and clicks
  • Twitter tweets
  • Google Plus ones and shares
  • Pinterest pins
  • LinkedIn shares

Downloads

The library can be downloaded from Maven Central using:

<dependency>
    <groupId>com.sangupta</groupId>
    <artifactId>socialcount</artifactId>
    <version>1.0.0</version>
</dependency>

Usage

The library can be used in two ways:

  • As a standalone command-line application
  • As an embedded library

Standalone App Usage

To run the command line version execute the following shelll command,

$ java -jar socialcount-1.0.0.jar

The console will keep reading URLs from console via user input, and will push out the metrics. To stop checking more URLs, simply return an empty URL.

One may also check URLs directly from command line as:

$ java -jar socialcount-1.0.0.jar http://facebook.com

Library usage

Using the library is pretty easy, as under,

String url = "http://facebook.com";
SocialCounts counts = SocialCountClient.getSocialCounts(url);

System.out.println("Facebook shares: " + counts.facebookShares);

The above example runs through each provider one by one, and thus may be slow in retrieving the sought information. The following example also shows the usage of a parallelized fetch from all these providers.

String url = "http://facebook.com";
SocialCounts counts = SocialCountClient.getSocialCountsParallel(url);

System.out.println("Facebook shares: " + counts.facebookShares);

This would be much faster than the previous, but will make use of parallel threads and may increase the load on the system a bit.

If you just want to fetch some specific counts, it is possible as,

String url = "http://facebook.com";
SocialCounts counts = new SocialCounts(url);

// fetch only twitter and facebook metrics
SocialCountClient.getTwitterCount(counts);
SocialCountClient.getFacebookCount(counts);

// only done to measure timing - no other significance
counts.markComplete();

Or better still, just configure the providers you want to run and the library takes care of the rest:

String url = "http://facebook.com";

// the config object can be reused as many times as want and is thread-safe
SocialCountConfig config = new SocialCountConfig();
config.twitter = true; // can be skipped as by default everything is true
config.facebook = true; // can be skipped as by default everything is true
config.googlePlusOne = false;
config.googleShares = false; // this one takes a lot of time
config.linkedin = false;
config.pinterest = false;

counts = SocialCountClient.getSocialCounts(url, config);

// or run the parallelized version
// counts = SocialCountClient.getSocialCountsParallel(url, config);

Release Logs

1.0.0

  • Integration with Facebook, Twitter, Google Plus, LinkedIn and Pinterest
  • Basic API structure

RoadMap

  • Add more providers - HackerNews, Reditt, StumbleUpon etc

Dependencies

socialcount depends on the following open-source frameworks

  • Apache HTTP Client library - for making HTTP requests
  • jerry-http - for working with web
  • Google GSON library - for JSON deserialization

Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, socialcounts will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the follow format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major
  • New additions without breaking backward compatibility bumps the minor
  • Bug fixes and misc changes bump the patch

For more information on SemVer, please visit http://semver.org/.

License

Copyright (c) 2014, Sandeep Gupta

The project uses various other libraries that are subject to their own license terms. See the distribution libraries or the project documentation for more details.

The entire source is licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the LICENSE. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
1.0.0