Skip to content

Commit

Permalink
Update build_wikidata.js
Browse files Browse the repository at this point in the history
patched oversight where the Facebook profile restriction check returns different results based on the country of the script operator when the restriction is location-based (qualifier Q113165094)
  • Loading branch information
Snowysauce committed Jan 18, 2025
1 parent db04548 commit 706b899
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/build_wikidata.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function processEntities(result) {
const value = q.datavalue.value.id;
// Q113165094 - location restrictions, Q58370623 - private account, Q107459441 - only visible when logged in
if (value === 'Q58370623' || value === 'Q107459441' || value === 'Q113165094') {
restriction = true;
restriction = value;
break;
}
}
Expand Down Expand Up @@ -694,8 +694,10 @@ function fetchFacebookLogo(qid, username, restriction) {
}

// queries of valid numeric IDs always return some data regardless of profile access status
if ( restriction && (!username.match(/^\d+$/) || target.logos.facebook) ) {
// show warning if Wikidata notes that access to the profile is restricted in some way, but the profile is public - #10233
if ( restriction && restriction !== 'Q113165094' && (!username.match(/^\d+$/) || target.logos.facebook) ) {
// show warning if Wikidata notes that access to the profile is restricted in certain ways, but the profile is public - #10233
// location restrictions (Q113165094) are skipped from this check because the API call will return different results
// when run by users from different countries
const warning = { qid: qid, msg: `Facebook username @${username} has a restricted access qualifier, but is publicly accessible` };
console.warn(chalk.yellow(warning.qid.padEnd(12)) + chalk.red(warning.msg));
_warnings.push(warning);
Expand Down

0 comments on commit 706b899

Please sign in to comment.