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 | 1x 1x 4x 10x 10x 10x 10x 5x 5x 5x 5x 5x 5x 5x 5x 5x 10x 4x 4x 4x 1x | import * as cheerio from 'cheerio' import { Service } from './service' class Facebook extends Service { static getProofUrl(proof: any) { return this.normalizeUrl(proof) } static normalizeUrl(proof: any) { let proofUrl = proof.proof_url.toLowerCase() const urlRegex = /(?:http[s]*:\/\/){0,1}(?:[a-zA-Z0-9-]+\.)+facebook\.com/ proofUrl = super.prefixScheme(proofUrl) if (proofUrl.startsWith('https://facebook.com')) { let tokens = proofUrl.split('https://facebook.com') proofUrl = `https://www.facebook.com${tokens[1]}` tokens = proofUrl.split('https://www.facebook.com/')[1].split('/posts/') const postId = tokens[1] proofUrl = `https://www.facebook.com/${proof.identifier}/posts/${postId}` } else Eif (proofUrl.match(urlRegex)) { const tokens = proofUrl.split('facebook.com/')[1].split('/posts/') const postId = tokens[1] proofUrl = `https://www.facebook.com/${proof.identifier}/posts/${postId}` } else { throw new Error(`Proof url ${proof.proof_url} is not valid for service ${proof.service}`) } return proofUrl } static getProofStatement(searchText: string) { const $ = cheerio.load(searchText) const statement = $('meta[name="description"]').attr('content') return (statement !== undefined) ? statement.trim() : '' } } export { Facebook } |