• Stars
    star
    155
  • Rank 240,817 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

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

Repository Details

Helps to get IDs or screen names from links to social network accounts

IDs, please

Build Status ids_please API Documentation

IDs, Please

Grab some hidden in html data from social account page. Get social network IDs or screen names from links to social network accounts.

Sometimes you need to get a social network account name from a link. To store a screen name in your database instead of parsing the link every time, or maybe to work with these accounts using social network APIs (as I do). Would be easier to have a library that extracts this kind of information from all known social networks for your pleasure.

Amplifr Sponsored by Evil Martians

Installation

gem install ids_please

Or, put this in your Gemfile:

gem 'ids_please'

Usage

This gem works in two modes – you can get real data from social network by HTTP request and page parsing and you can just parse a link to social account to find username/id. Sometimes username from link can't be used with social network's API, in this case, try to get real ID with grab mode.

Grabbing data from social account's page

This functionality works through real HTTP requests, so if you feed it with many links – it can take a while.

As Facebook shows data only from public pages and public groups – in most cases you can't gather data from any profile page. Same thing about private Instagram accounts, profiles and private groups in vk.

Also, you should provide real URLs with right protocols. For example, you will not receive any data from http://facebook.com/Microsoft, but from https://facebook.com/Microsoft you'll receive all data as in example below:

ids = IdsPlease.new('https://instagram.com/microsoft/', 'https://facebook.com/Microsoft')
ids.grab
=> {:instagram=>
    [IdsPlease::Grabbers::Instagram#70339427221180
      @link=https://instagram.com/microsoft/,
      @network_id=524549267,
      @avatar=https://igcdn-photos-h-a.akamaihd.net/hphotos-ak-xpf1/t51.2885-19/10729318_654650964633655_619168277_a.jpg,
      @display_name=Microsoft,
      @username=microsoft,
      @data={:bio=>"The official Instagram account of Microsoft. Celebrating people who break boundaries, achieve their goals, and #DoMore every day.", :website=>"http://msft.it/MSFTDoMore"}],
    :facebook=>
    [IdsPlease::Grabbers::Facebook#70339427168960
      @link=https://facebook.com/Microsoft,
      @network_id=20528438720,
      @avatar=https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/v/t1.0-1/394366_10151053222893721_1961351328_n.jpg?oh=f3efc47a669cf291221ca421eaf016fb&oe=55C61365&__gda__=1440162054_3bf920ed0b4c0c7873c4ec44affcec15,
      @display_name=Microsoft,
      @username=Microsoft,
      @data={:type=>"company", :description=>"Welcome to the official Microsoft Facebook page, your source for news and conversation about..."}
    ]
   }

insta = ids.grabbed[:instagram].first
insta.avatar
=> "https://igcdn-photos-h-a.akamaihd.net/hphotos-ak-xpf1/t51.2885-19/10729318_654650964633655_619168277_a.jpg"

Social networks supported for grabbing at the moment:

Link parsing

ids = IdsPlease.new('https://twitter.com/gazay', 'http://facebook.com/alexey.gaziev')
ids.parse
puts ids.parsed[:twitter]  # => ["gazay"]
puts ids.parsed[:facebook] # => ["alexey.gaziev"]

puts ids.original           # => ["https://twitter.com/gazay", "http://facebook.com/alexey.gaziev"]

Or you can just check that the link is for a known social network:

ids = IdsPlease.new('https://twitter.com/gazay', 'http://some-unknown-network.com/gazay')
ids.recognize
puts ids.recognized   # => {:twitter=>[#<URI::HTTP:0x007fea3bba7e30 URL:http://twitter.com/gazay>]}
puts ids.unrecognized # => ["http://some-unknown-network.com/gazay"]

Social networks supported at the moment:

Contributors

  • @gazay

Special thanks to @ai, @yaroslav, @whitequark

Notes

Gem named under an impression of an awesome game called Papers, please.

Logo of gem also was inspired by its logo.

Thanks @dukope for allowing me to do this!

License

The MIT License

More Repositories

1

gon

Your Rails variables in your JS
Ruby
3,036
star
2

talks

Talking hooks for long lasted cli tools
Ruby
103
star
3

gon-sinatra

Your Sinatra variables in your JS
Ruby
83
star
4

node-emoji-clock

JavaScript
78
star
5

share_some_love

Share some love to our buddies rubyists!
Ruby
26
star
6

odnoklassniki

Ruby wrapper for Odnoklassniki API
Ruby
24
star
7

tonic

gh-pages with sass, haml, coffee (and compass)
Ruby
23
star
8

environment

Ubuntu install and setup
Shell
12
star
9

spik

Let spik with Rails!
Ruby
11
star
10

mnemonic

Simple logger to show where is leaking by many-many puts
Ruby
10
star
11

is

Small simple tool for finding points in polygons
Ruby
6
star
12

gobrain

Rails Rumble Entry for Gobrain
JavaScript
4
star
13

repka

Repka will help you easily gather stats from controllers if you use mongoid
Ruby
4
star
14

dlnd-project-02

Image classification problem with convolutional networks
Jupyter Notebook
3
star
15

diffit

A simple solution to track changes in your tables.
Ruby
2
star
16

dlnd_tv_script_generation

HTML
2
star
17

movie-alert

Repository for the RailsRumble 2009 Team 74
JavaScript
2
star
18

node-utf-format

Ⓕⓞⓡⓜⓐⓣ ᴛᴇxᴛ with utf-8 power
JavaScript
2
star
19

kubik

Sugar for kubernetes for lazy developers
2
star
20

lysa-old

Clone of https://github.com/learnyou/lysa
TeX
2
star
21

postcss-demo

Gulp application to check how all PostCSS plugins work
HTML
2
star
22

hat_on_the_head

Jupyter Notebook
1
star
23

anybitchcancode

really
1
star
24

recsys_learning

Jupyter Notebook
1
star
25

scheme48

http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours
1
star
26

bioreactor

Repository for the RailsRumble 2010 Team 69
JavaScript
1
star
27

repka_ar

Easy stats collecting with ActiveRecord (Use REPKA and MongoDB, Luke). This is PRE-ALPHA, when this will work, i'll let you know ;)
Ruby
1
star
28

friendly_admin

Friendly admin
Ruby
1
star
29

nuclear_safety

diploma project to solving nuclear safety problem
Ruby
1
star
30

dlnd-project-01

First project of dlnd
HTML
1
star
31

battletoads

Tools to generate demo applications for PostCSS plugins
Ruby
1
star
32

ruby-lang.org-templates

Translation templates for www.ruby-lang.org news
1
star
33

dlnd-project-04

Language translation project from dlnd
HTML
1
star
34

dlnd-face-generation

final project of DLND
HTML
1
star