Skip to content

Commit

Permalink
[instagram] resolve issue with CSS selector
Browse files Browse the repository at this point in the history
  • Loading branch information
JorgenEvens committed Sep 14, 2019
1 parent 8c0dc93 commit 150f03a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/networks/instagram/strategies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const profilePicRegexp = /"profile_pic_url_hd"\s*:\s*"([^"]+)"/i;
async function profileScrape(username) {
username = encodeURIComponent(username);

const res = await fetch(`https://www.instagram.com/${username}`);
const res = await fetch(`https://www.instagram.com/${username}/`);
const html = await res.text();
const doc = cheerio.load(html);
const scripts = doc('script').get();
Expand All @@ -20,10 +20,10 @@ async function profileScrape(username) {
return picture[1];
}

if (doc('meta[property=og:type]').attr('content') != 'profile')
if (doc('meta[property="og:type"]').attr('content') != 'profile')
return null;

return doc('meta[property=og:image]').attr('content');
return doc('meta[property="og:image"]').attr('content');
}

module.exports = [
Expand Down

0 comments on commit 150f03a

Please sign in to comment.