Flickr images should generally be moved to Commons where there is a process in place for validating the license. Otherwise, when a Flickr user closes their account, we cannot be certain that the license was ever correct and have to delete the image.
https://quarry.wmflabs.org/query/29759
USE enwiki_p;
SELECT DISTINCT CONCAT('File:', p.page_title) FROM page p
INNER JOIN externallinks ON el_from = p.page_id
/*LEFT JOIN imagelinks i ON p.page_title = i.il_to -- AND (i.il_from_namespace = 0) */
LEFT JOIN categorylinks c1 ON p.page_id = c1.cl_from AND c1.cl_to = "All_non-free_media"
LEFT JOIN redirect on rd_from = p.page_id
WHERE /*i.il_from IS NULL
AND*/ p.page_namespace = 6
AND c1.cl_to IS NULL -- Exclude fair use - other processes will handle those
AND rd_title IS NULL -- Exclude redirects
AND el_to LIKE '%flickr%'
ORDER BY page_id DESC
LIMIT 20000