module Sources::Strategies class Twitter < Base PAGE = %r{\Ahttps?://(?:mobile\.)?twitter\.com}i PROFILE = %r{\Ahttps?://(?:mobile\.)?twitter.com/(?[a-z0-9_]+)}i # https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb.jpg # https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb?format=jpg&name=900x900 # https://pbs.twimg.com/tweet_video_thumb/ETkN_L3X0AMy1aT.jpg # https://pbs.twimg.com/ext_tw_video_thumb/1243725361986375680/pu/img/JDA7g7lcw7wK-PIv.jpg # https://pbs.twimg.com/amplify_video_thumb/1215590775364259840/img/lolCkEEioFZTb5dl.jpg BASE_IMAGE_URL = %r{\Ahttps?://pbs\.twimg\.com/(?media|tweet_video_thumb|ext_tw_video_thumb|amplify_video_thumb)}i FILENAME1 = /(?[a-zA-Z0-9_-]+)\.(?\w+)/i FILENAME2 = /(?[a-zA-Z0-9_-]+)\?.*format=(?\w+)/i FILEPATH1 = %r{(?\d+/[\w_-]+/img)}i FILEPATH2 = %r{(?\d+/img)}i IMAGE_URL1 = %r{#{BASE_IMAGE_URL}/#{Regexp.union(FILENAME1, FILENAME2)}}i IMAGE_URL2 = %r{#{BASE_IMAGE_URL}/#{Regexp.union(FILEPATH1, FILEPATH2)}/#{FILENAME1}}i # Twitter provides a list but it's inaccurate; some names ('intent') aren't # included and other names in the list aren't actually reserved. # https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration RESERVED_USERNAMES = %w[home i intent search] # List of hashtag suffixes attached to tag other names # Ex: 西住みほ生誕祭2019 should be checked as 西住みほ # The regexes will not match if there is nothing preceding # the pattern to avoid creating empty strings. COMMON_TAG_REGEXES = [ /(?