Sha256: 493f7ddedf1affae76be77995934c5bea6260b5bb7c1242f5f7956338ab01632
Contents?: true
Size: 922 Bytes
Versions: 10
Compression:
Stored size: 922 Bytes
Contents
require 'social_parser/provider/base' module SocialParser module Provider class Facebook < Base URL_FORMATS = { full: /\A((https?)?:\/\/)?(www\.)?facebook\.com\/(\w*#!\/)?(pages\/[\w\-]*)?([?\d\-]*\/)?(profile\.php\?id=(?=\d.*))?(?<id>[\w\-\.]*)?/i, # full: /((http|https):\/\/)?(www\.)?facebook.com\/(?:(?:\w)*#!\/)?(?:pages\/[\w\-]*)?(?:[?\d\-]*\/)?(?:profile.php\?id=(?=\d.*))?(?<id>[\w\-\.]*)?/i, regular: /\Ahttps?:\/\/www\.facebook\.com\/(?!sharer\/)(?!share\.php\?)(?!sharer\.php\?)(?<id>.+?)\/?\Z/, shorter: /\Ahttps?:\/\/facebook\.com\/(?!sharer\/)(?!share\.php\?)(?!sharer\.php\?)(?<id>.+?)\/?\Z/ } def provider :facebook end private def parse_from_url URL_FORMATS.values.each do |format| m = format.match(url_from_attributes) return m[:id] if m end nil end end end end
Version data entries
10 entries across 10 versions & 1 rubygems