Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elmarti/social-media-url-parser
A simple data factory for social media data
https://github.com/elmarti/social-media-url-parser
Last synced: 5 days ago
JSON representation
A simple data factory for social media data
- Host: GitHub
- URL: https://github.com/elmarti/social-media-url-parser
- Owner: elmarti
- Created: 2016-02-07T21:02:05.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-22T13:23:23.000Z (about 7 years ago)
- Last Synced: 2024-10-27T21:03:58.765Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Social Media URL Parser
===================
(supports Twitter, LinkedIn and Facebook - raise a GitHub issue if you want more)
Get all the data you need to process social media link data
----------**THE PROBLEM**
You want users to input their Twitter handle or URL, but don't want to confuse them with specifying a format i.e. full url, twitter handle, user id, linkedin extension etc.**THE SOLUTION**
Simply dump your URL or userId in `socialMediaURL.parse` to get all the data you need.
**From id**``` socialMediaURL.parse("Lolem1psum", "TWITTER"); ```
Which returns```javascript
{
hostname: "twitter.com",
href: "https://www.twitter.com/Lolem1psum",
pathname: "/Lolem1psum",
service: "TWITTER",
twitterHandle: "@Lolem1psum",
type: "ID",
userId: "Lolem1psum"
}`
```
Whereas:
```javascript
socialMediaURL.parse("https://www.facebook.com/lolem1psum");
```returns
```javascript
{
hostname: "www.facebook.com",
href: "https://www.facebook.com/lolem1psum",
pathname: "/lolem1psum",
service: "FACEBOOK",
type: "URL",
userId: "lolem1psum"
}
```