• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Python
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross platform middleware for Social Networking Services: Twitter, Facebook, SinaWeibo, Renren, RSS, Email, Sqlite, ... (more coming)

NOTICE:

This projects is no longer maintained. However, the concept being pursued and the rationales are still valid. Would like to hear from anyone who works on similar stuff. Hope one day the Meta Social Network dream can come true. Let us decentralize teh social networking landscape!

The following list of resources may be useful to you: (PR to expand the list are highly welcome)

I am also available to talk. Feel free to dig out email from commit history, =D.


SNSAPI

A cross-platform middleware for Social Networking Services (SNS):

Lightning Demo 1 -- Read Twitter Timeline

Step 1.

Register user and developer on Twitter. Apply for application keys and access tokens.

Step 2.

Save the following codes to mytest.py in the root dir of this project:

from snscli import *
nc = new_channel('TwitterStatus')
nc['app_key'] = 'Your Consumer Key from dev.twitter.com'
nc['app_secret'] = 'Your Consumer Secret from dev.twitter.com'
nc['access_key'] = 'Your Access Token from dev.twitter.com'
nc['access_secret'] = 'Your Access Token Secret from dev.twitter.com'
add_channel(nc)
print home_timeline()

Filling your app credentials in the above script: app_key, app_secret, access_key, access_key.

Step 3.

Try it by python mytest.py. You will see your home timeline from twitter.

Remarks

SNSApi unifies the interfaces of all SNS such that retrieving new messages from all other platforms are the same:

  • Create a new channel configuration and add_channel it.
  • Invoke a single home_timeline() to obtain an aggregated timeline from all channels in a batch.

Lightning Demo 2 -- Backup Your Data

Step 1.

Configure a channel.json file with two channels:

  • One is called "myrenren" and it interfaces with Renren (an OSN in China).
  • The other is called "mysqlite" and it interfaces with a SQLite3 DB.

See one example channel.json configuration.

Step 2.

Save the following codes to backup.py in the root dir of this project:

from snsapi.snspocket import SNSPocket
sp = SNSPocket()
sp.load_config()
sp.auth()

ml = sp['myrenren'].home_timeline()
for m in ml:
    sp['mysqlite'].update(m)

Step 3.

Try it by python backup.py. Now your timeline of Renren (latest 20 messages by default) is backed up to the SQLite DB. You can run this script on a regular basis to backup data from all kinds of SNS.

Remarks

SNSApi unifies the data structures of all SNS so as to enable flexible/ programmable inter-operation between those services:

  • Backup one message in SQLite is just "update a status" there.
  • In order to read those messages, just invoke home_timeline of your SQLite channel.
  • The data in SQLite DB are ready for further analysis. For example, I remember someone said that "snsapi is awesome". Who posted it? I can not recall. Now, enter sqlite and use one line of command to get the answer: select * from message where text like '%snsapi%';.
  • You can also use EMail or RSS to distribute your statuses and follow the updates of your friends.
  • When there are new platforms, it's just one configuration away to use them. The intervention from app developer is not needed.

Lightning Demo 3 -- An Ad-Hoc DSN

Decentralized Social Network (DSN) is the next paradigm of social networking. Current centralized services have a lot of problems, e.g. Spying for free.

SNSApi is just a middleware to offload your burden in interfacing with different platforms. Now, try to build something without worrying about the interfacing detials.

See RSoc Community Page if you are interested.

Supported Platforms

Enther the interactive shell by python -i snscli.py. Get the supported platforms as follows:

Supported platforms:
   * DoubanFeed
   * Email
   * FacebookFeed
   * InstagramFeed
   * RSS
   * RSS2RW
   * RSSSummary
   * RenrenBlog
   * RenrenFeed
   * RenrenPhoto
   * RenrenShare
   * RenrenStatus
   * RenrenStatusDirect
   * SQLite
   * SinaWeiboBase
   * SinaWeiboStatus
   * SinaWeiboWapStatus
   * TencentWeiboStatus
   * TwitterStatus
   * ...

More platforms are coming! Please join us!

Get Started

  • Clone and install dependencies via pip. Then you are ready to go. See installation guide if you need more detailed information. See troubleshooting page if you encounter problems in your initial tests.
  • We have several demo apps in this repo. You can start with them and see how to use those classes of SNSAPI.
  • Users who don't want to write Python or other non-Python programmers can start with our command-line-interface (snscli.py). The official SNSAPI website should get your started quickly along this line. This CLI can allow interfacing with other languages using STDIN/ STDOUT.
  • Users who are not comfortable with CLI can use the graphical-user-interface (snsgui.py). See more user interfaces.

Resources

License

copyleft

All materials of this project are released to public domain, except for the followings:

  • snsapi/third/*: The third party modules. Please refer to their original LICENSE. We have pointers in snsapi/third/README.md for those third party modules.

Other

master dev Analytics

More Repositories

1

python-for-data-and-media-communication-gitbook

An open source book on Python tailed for communication students with zero background
Python
115
star
2

tutorial

HPL's Tutorials
TeX
22
star
3

big-road

The simplist's solution to the mobile-only web story
HTML
21
star
4

sns-router

Intelligent Cross Domain SNS Router
Python
14
star
5

python-for-data-and-media-communication

Sample codes and datasets for COMM7780/ JOUR7280 @ HKBU
Jupyter Notebook
12
star
6

60-data-science-book-visualisation

10
star
7

workshop-easy-scraping-PyConHK-2015

Really easy scraping in Python.
HTML
10
star
8

pquery

grep for HTML; CLI for pyquery
Python
9
star
9

rfc.bib

rfc.bib from rfc-index.xml
TeX
9
star
10

oauth.io-demo-twitter

Demo of retrieving Twitter timeline using integrated OAuth solution provided by oauth.io
7
star
11

evermd

Ever MarkDown! Solution Stacks for Markdown Usage
C
5
star
12

min-mac-app

Minimalist's MAC App Creation
Python
5
star
13

userscripts

userscripts of GreaseMonkey
JavaScript
5
star
14

asuswrt-merlin-setup

Notes, configs and commands for setting up an asuswrt-merlin router for entire family to access Internet scientifically
Shell
4
star
15

wechat-egonet

Reference codes to collect wechat ego network data ( group--people bipartite graph )
Python
4
star
16

wget2-docker

4
star
17

multiret

multi-value-return pattern in Python
Python
3
star
18

geohk

Some know-how and output to deal with Hong Kong's geographical data in modern format
Shell
3
star
19

heatmap2stl

Convert a heatmap into STL format for 3D Printing
Python
3
star
20

hhba2016-argentina-vote

Virtual reality visualisation on Google cardboard of Argentina congress voting pattern with PCA and A-frame
Jupyter Notebook
3
star
21

utility

dotfiles, small tools, etc. for linux, mac, and windows
Vim Script
3
star
22

hhba2016-hk-legco-dataset-2012-2016

Jupyter Notebook
2
star
23

sina-automator

Tool Chain for Making SinaWeibo Bot
Python
2
star
24

summary-bot

Use automatic text summarisation to tweet articles from some mainstream media, just a POC
Python
2
star
25

agile-ir

Principles and Methodology of Agile Personal Information Retrieval
Batchfile
2
star
26

py-hupili

My utility collection
Python
1
star
27

engg4030

Tutorial notes for ENGG4030
CSS
1
star
28

hk-border-traffic-gcp-demo

Python
1
star
29

hpl-code-snippets

My own code snippets during theses years. Still in the process of reorganising. May not be useful for your production purpose. Can be reference if you are learning sth.
C
1
star
30

iberian-360

A low-cost VR record of my Iberian tour
HTML
1
star
31

mma-hkbu-vpn

Python
1
star
32

snsapi-website

the website of snsapi project
CSS
1
star
33

geojson-to-gpx-with-time

Rescue the Strava track when your phone / watch run out of battery.. You know how it feels when sh*t happens
Python
1
star
34

openrice-data-blog-201811

Jupyter Notebook
1
star
35

code4hk-20150314-techparty

Code4HK presentation on SZ TechParty, 20150314
HTML
1
star
36

Adaptive-Data-Streaming

adaptive data streming: a survey and case study
MATLAB
1
star
37

mgcli

A Simple CLI for MailGun
Python
1
star
38

lnk-parser

Automatically exported from code.google.com/p/lnk-parser
C++
1
star
39

workshop-data-literacy-excel-experiments-101

4 bespoke data experiments in Excel for data literacy 101
1
star