Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 5x 5x 2x 1x 1x | import { Service, CheerioModuleType } from './service' import { AccountProofInfo } from '../profileProofs' class Twitter extends Service { getBaseUrls() { const baseUrls = [ 'https://twitter.com/', 'http://twitter.com/', 'twitter.com/' ] return baseUrls } normalizeUrl(_proof: AccountProofInfo) { return '' } getProofStatement(searchText: string, cheerio: CheerioModuleType) { const $ = cheerio.load(searchText) const statement = $('meta[property="og:description"]').attr('content') Eif (statement !== undefined) { return statement.trim().replace('“', '').replace('”', '') } else { return '' } } getProofUrl(proof: AccountProofInfo): string { const baseUrls = this.getBaseUrls() let proofUrl = proof.proof_url.toLowerCase() proofUrl = this.prefixScheme(proofUrl) for (let i = 0; i < baseUrls.length; i++) { const requiredPrefix = `${baseUrls[i]}${proof.identifier}`.toLowerCase() if (proofUrl.startsWith(requiredPrefix)) { return proofUrl } } throw new Error(`Proof url ${proof.proof_url} is not valid for service ${proof.service}`) } } export { Twitter } |