7

This is a request for help for fixing the broken images when switching to HTTPS soon (originated from Roadmap to HTTPS: serving and uploading HTTPS-images only).

There is a Crowd Crafting project set up by m0sa to update posts which contain broken image links. Help us to update all those posts to either have a valid (and HTTPS) image again, or remove the broken image from the post.

Some posts might not be salvageable and should be deleted, so use your powers to help with that too please.

Please post any problems when going through the queue here, and let's discuss how to handle them.

15
  • Is there a SEDE query to find posts that don't have imgur pictures?
    – Mithical
    Commented Mar 7, 2017 at 8:52
  • I guess there is, but that isn't the scope of this project. We only want to fix broken links, not links to any external source. Commented Mar 7, 2017 at 8:54
  • Right, but that would help find images that don't have a https.
    – Mithical
    Commented Mar 7, 2017 at 8:55
  • That is already done by the SE internal project. We don't have to do that. They just hand over a list of broken images. Commented Mar 7, 2017 at 8:55
  • Ah, I misunderstood. Okay.
    – Mithical
    Commented Mar 7, 2017 at 8:56
  • umm.... why did you fix images in deleted answer? Commented Mar 7, 2017 at 9:29
  • I guess deleted posts are included... First handful of post links I got were 404
    – Cai
    Commented Mar 7, 2017 at 9:32
  • Yeah. m0sa added deleted posts too. You can't get them out of the queue otherwise... @ShadowWizard Commented Mar 7, 2017 at 9:33
  • 4
    Think it's better to remove them, it's pointless to edit deleted posts, both wasting time and bumping to the front page where most users won't even see the change. Will you ask m0sa to do that please? Commented Mar 7, 2017 at 9:35
  • I already did. I guess he needs to upload again. Commented Mar 7, 2017 at 9:42
  • Okay, why is the crowdsourcing thing only showing me the same two posts?
    – Mithical
    Commented Mar 7, 2017 at 10:12
  • 1
    Yeh, keeps showing me the same handful of deleted posts
    – Cai
    Commented Mar 7, 2017 at 10:18
  • 1
    Same problem. I only get to review questions 4525 and 4545, both of which are deleted.
    – 54D
    Commented Mar 7, 2017 at 10:55
  • It works for me. It seems however that not everyone hits the Done button, hence it doesn't get removed from the queue. Commented Mar 7, 2017 at 11:00
  • 3
    It's impossible for some of us to move on then. Since I must click Skip for 404 pages, I end up getting cycling between two deleted questions.
    – 54D
    Commented Mar 7, 2017 at 11:38

2 Answers 2

4

Please hang in everyone... I've asked m0sa to update the list to exclude deleted posts. Since it is not very likely they ever will be undeleted, it is better to exclude them. The majority of posts with invalid images seem to be deleted after all, so that cleans up nicely.

0
4

I've written the following snippet so you can return and filter the Crowdcrafting tasks by site.

It currently returns up to 100 tasks (the maximum the API allows). It looks like a lot of sites have fewer affected posts than that, there's no instant way to get further posts for the ones that do though. It is possible to paginate results through the API (see the last note here), so maybe I'll look at adding that later.

I've included links to the SE post (both view and edit links) and the Crowdcrafting task page so that you can hit "Done" on the task, which should eventually get you more tasks (it takes 2 "Done"s to remove the post from the queue I believe).

Just pick a site, hit "Get Tasks" and work through the links...

function getget(url, callback) {
  var xhr = new XMLHttpRequest();
  xhr.addEventListener('load', function() {
    var response = JSON.parse(xhr.responseText);
    callback(response);
  });
  xhr.open('GET', url);
  xhr.send();
}

function loadSites() {
  var url = 'https://api.stackexchange.com/2.2/sites?pagesize=300&filter=!*L6Sij27hkbD7Gso';
  getget(url, listSites);
}

function listSites(sites) {
  var goBtn = document.getElementById('getTasks');
  var sitesList = document.getElementById('sites');

  for (var i = 0; i < sites.items.length; i++) {
    var siteUrl = sites.items[i].site_url.replace(/^https?\:\/\//i, "");
    var opt = document.createElement('option');
    opt.value = siteUrl;
    opt.textContent = sites.items[i].name;
    sitesList.appendChild(opt);
  }

  goBtn.innerText = 'Get Tasks';
  goBtn.disabled = false;
}

function listTasks(tasks, el) {
  for (var i = 0; i < tasks.length; i++) {
    var task = tasks[i],
      info = task.info,
      taskID = task.id,
      // borked column headers again...
      postID = info['PostId'] || info['12'] || info['149'] || info['73'] || '',
      siteName = info.BaseHostAddress || info['meta.serverfault.com'] || info['askubuntu.com'] || info['sound.stackexchange.com'] || '';

    lastID = taskID;

    var span = document.createElement('span');
    span.innerText = 'Post ' + postID + ':';

    var seViewLink = document.createElement('a');
    seViewLink.href = '//' + siteName + '/questions/' + postID;
    seViewLink.innerText = 'View';

    var seEditLink = document.createElement('a');
    seEditLink.href = '//' + siteName + '/posts/' + postID + '/edit';
    seEditLink.innerText = 'Edit';

    var ccLink = document.createElement('a');
    ccLink.className = 'ccLink';
    ccLink.href = '//crowdcrafting.org/project/sehttpimagescleanup/task/' + taskID;
    ccLink.innerText = 'Crowdcrafting Task ' + taskID;

    var li = document.createElement('li');
    li.appendChild(span);
    li.appendChild(seViewLink);
    li.appendChild(seEditLink);
    li.appendChild(ccLink);
    results.appendChild(li);
  }
}

function init() {
  var goBtn = document.getElementById('getTasks');
  goBtn.addEventListener('click', function() {

    var results = document.getElementById('results');
    results.innerHTML = '';

    var site = document.getElementById('sites').value;
    var searchUrl = '//crowdcrafting.org/api/task?project_id=4667&limit=100&info=BaseHostAddress::' + site;
    getget(searchUrl, listTasks, results);

    // task columns are borked... let's run this a few times
    var searchUrl = '//crowdcrafting.org/api/task?project_id=4667&limit=100&info=meta.serverfault.com::' + site;
    getget(searchUrl, listTasks, results);
    var searchUrl = '//crowdcrafting.org/api/task?project_id=4667&limit=100&info=askubuntu.com::' + site;
    getget(searchUrl, listTasks, results);
    var searchUrl = '//crowdcrafting.org/api/task?project_id=4667&limit=100&info=sound.stackexchange.com::' + site;
    getget(searchUrl, listTasks, results);
  });
  loadSites();
}

// go!
init();
ul { list-style: none; margin: 1em 0; padding: 0; }
li { margin: 0; padding: .5em 0; }
span { display: inline-block; width: 6em; }
a { color: #fff; background-color: #03A7DD; border-radius: 4px; padding: .25em .5em; margin: 0 .5em 0 0; text-decoration: none; }
a.ccLink { background-color: #2B9884; }
<label>Site: <select id="sites"></select></label>
<button id="getTasks" disabled>Loading Sites...</button>
<ul id="results"></ul>

Note, links in Stack Snippets don't really work... just open them in a new tab (ctrl+click, middle-click, right-click+"Open in New Tab" or whatever)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .