Code Monkey home page Code Monkey logo

ids_please's Introduction

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

ids_please's People

Contributors

gazay avatar bastosmichael avatar n10v avatar caiosba avatar wilddima avatar aegorov avatar achempion avatar razum2um avatar

Stargazers

Anne Thorpe avatar Hai Nguyen avatar Yasin ATEŞ avatar  avatar Kidd Hustle avatar Carolina Zarate avatar Evan Alter avatar Cheng-Yen Liu avatar  avatar Abhilash Reddy avatar ecomarine avatar  avatar Statanis 123 avatar Serhii Ponomarov avatar Alek Malaszkiewicz avatar Artem Nistratov avatar Winston avatar  avatar Angus H. avatar Gert Jørgensen avatar Manuel Meurer avatar Maxime Garcia avatar Wing Ho avatar Dzmitry Ilyashevich avatar Ilya Solo avatar Peter avatar Mark Tran avatar Vitaliy A avatar Harry V. Kiselev avatar Steven McIntyre avatar Vadym Poplavskyi avatar Cayo Medeiros avatar  avatar Pantelis Koukousoulas avatar Faruk Celik avatar Robert Audi avatar  avatar Steven Eksteen avatar Michael Chrisco avatar Andrea Dal Ponte avatar Tatsuya Arai avatar Ender Ahmet Yurt avatar Yury Druzhkov avatar Shamil Fattakhov avatar Ahmet Abdi avatar Max Shirokov avatar DJ Patterson avatar Kevin Tran avatar Matt Slater avatar ranendra adhikari avatar Danil Karpov avatar  avatar Gregorius Kusumo avatar Stan Lo avatar Eric Turner avatar Libin Pan avatar Adham EL-Deeb avatar Karthik Kamalakannan avatar Roberto Salicio avatar  avatar mihey avatar Alexander Kurganov avatar Gosha Spark avatar Claudel Sylvain avatar Karim Kiatlottiavi avatar Matt Solt avatar Rick Carlino avatar Vlad Alive avatar Víctor Pérez avatar Mike avatar Andrey Shramko avatar Natik Gadzhi avatar Ivan Vlasenko avatar Ilya Nazarov avatar Alexey Badenkov avatar Sergei O. Udalov avatar Joe Murphy avatar Steve Hoeksema avatar Hank Beaver avatar Alive Whatever avatar Michele Piccirillo avatar Andrey Krivko avatar Frank Koehl avatar sandy avatar Alex avatar Wadim Biekisz avatar cenan ozen avatar Ferdy avatar Radovan Šmitala avatar Danilo avatar Alix Axel avatar ZhenYu Chen avatar Jason Lewis avatar Vladimir Vinnikov avatar Neo Melonas avatar Sébastien Charrier avatar Ferenc Fekete avatar Lalit Shandilya avatar Tim Riley avatar Damien avatar

Watchers

Dane Charles Vincent II avatar  avatar  avatar Statanis 123 avatar Rachel Morrell avatar  avatar  avatar

ids_please's Issues

Why do you parse HTML pages?

I can't understand: why do you parse HTML pages from social networks instead of using API to grab information?
All hidden information in social network pages contains in API responses.
Using API much faster and easier to code.
Sorry, if I don't understand project's philosophy, but I read README several times and tried to understand it :(

Instagram Grabber Display Name needs tweaking

Not all instagram accounts seem to use the same selector for the Display name. I'll need to update this or if someone wants to give it a shot should be easy to take care of. Here are a few examples.

 "https://instagram.com/cinchjeans",
 "https://instagram.com/rdaltoncoffee",
 "https://instagram.com/martamanhattan",
 "https://instagram.com/revolutiondurham",
 "https://instagram.com/thinkgrillnj",
 "https://instagram.com/johnsincrediblepizzacompany",
 "https://instagram.com/tsukurofl",
 "https://instagram.com/triplebbar",
 "https://instagram.com/spicethainyc",
 "https://instagram.com/ciboteca",
 "https://instagram.com/jjwhauer",
 "https://instagram.com/doubleogrill",
 "https://instagram.com/mancysbluewatergrille",
 "https://instagram.com/shawneepeakme",
 "https://instagram.com/alabamaque",
 "https://instagram.com/centercitypark",
 "https://instagram.com/nylacast",
 "https://instagram.com/earshotjazz",
 "https://instagram.com/tomatopiepizzajoint",
 "https://instagram.com/altasierraski",
 "https://instagram.com/thesunrisegrill",
 "https://instagram.com/districtsf",
 "https://instagram.com/themandywarhols",
 "https://instagram.com/gorhamsbluffal",
 "https://instagram.com/miniofmadison",
 "https://instagram.com/alamosa_colorado",
 "https://instagram.com/cirospizza",
 "https://instagram.com/phongdinhfood",
 "https://instagram.com/beckmannsbakery",
 "https://instagram.com/rosebakery",
 "https://instagram.com/lumbervillegeneralstore",
 "https://instagram.com/djhypnotic82",
 "https://instagram.com/truth360bdc",
 "https://instagram.com/cafejavasti",
 "https://instagram.com/hottiesworld",
 "https://instagram.com/hoffbrausteaks",
 "https://instagram.com/schulziesbreadpudding",
 "https://instagram.com/kaleidoscopejuice",
 "https://instagram.com/superchix1",
 "https://instagram.com/kimmiescoffeecup",
 "https://instagram.com/azuracafe",
 "https://instagram.com/purplemtnbb",
 "https://instagram.com/theweekendtheater",
 "https://instagram.com/hotelandra",
 "https://instagram.com/cottonwoodmeadowlodge",
 "https://instagram.com/hometownheroesny",
 "https://instagram.com/westshorecafe",
 "https://instagram.com/hatfields",
 "https://instagram.com/animalvinny",
 "https://instagram.com/blackhousesv",
 "https://instagram.com/teenypies",
 "https://instagram.com/walloonlakeinn",
 "https://instagram.com/catalinacafe",
 "https://instagram.com/thebethwood",
 "https://instagram.com/spiegelnyc",
 "https://instagram.com/coyotegrille",
 "https://instagram.com/villagehatshop",
 "https://instagram.com/312_chicago",
 "https://instagram.com/sgiusa",
 "https://instagram.com/ralphiesfun",
 "https://instagram.com/ejhodgkinson",
 "https://instagram.com/thewaverlyschool",
 "https://instagram.com/ilovepallino",
 "https://instagram.com/roesersbakery",
 "https://instagram.com/evelynskitchen",
 "https://instagram.com/segearsandcheers",
 "https://instagram.com/volitionfit",
 "https://instagram.com/lonestarcafesa",
 "https://instagram.com/cafeviennaprinceton",
 "https://instagram.com/berrydivecenter",
 "https://instagram.com/enzosofbonita",
 "https://instagram.com/lonewolftavern",
 "https://instagram.com/michael_angelos",
 "https://instagram.com/revelart",
 "https://instagram.com/myamazingtans",
 "https://instagram.com/jamesonsirishpub",
 "https://instagram.com/ecofriendlymaidservice",
 "https://instagram.com/atasteofdistinction",
 "https://instagram.com/username",
 "https://instagram.com/axeandfiddle",
 "https://instagram.com/616wraps",
 "https://instagram.com/oaksteakhouse",
 "https://instagram.com/justartgallery",
 "https://instagram.com/larrysvenice"```

How about executable?

Do you think about executable for this? It will be very convenient to grab and view all information from terminal window.
P.S. I can help with this and contribute if you interested in it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.