Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloaded images contain the text "URI signature match failed" - An issue with the links reddit provides #6

Closed
ipaqmaster opened this issue Feb 22, 2018 · 1 comment

Comments

@ipaqmaster
Copy link

ipaqmaster commented Feb 22, 2018

All i.redditmedia links appear to "Download Successfully" for me however catting them, all their contents are the ascii text URI signature match failed

This reddit post from last year matches and describes the problem as &amp appearing in the URLs fetched rather than just '&'. This started happening to me on the 18th of Feburary 2018.

@ipaqmaster
Copy link
Author

ipaqmaster commented Feb 22, 2018

I solved this by performing to following change to index.js's downloadImage function located at the bottom of the file:

Original:

function downloadImage (url, filename, callback) {
  var urlfixed = url.replace("&", "&");
  url = urlfixed
  request(url)
  .pipe(fs.createWriteStream(filename))
  .on('close', () => {
    console.log(url, chalk.green(' downloaded successfully'))
    callback(null, filename)
  })
}

New: including a new change at the top of the function.

function downloadImage (url, filename, callback) {
  var urlfixed = url.replace("&", "&");
  url = urlfixed
  request(url)
  .pipe(fs.createWriteStream(filename))
  .on('close', () => {
    console.log(url, chalk.green(' downloaded successfully'))
    callback(null, filename)
  })
}

By adding

  var urlfixed = url.replace("&", "&");`
`  url = urlfixed

..to the top of the function I'm able to remove the &'s from the download task. Trash fix I know, but it seems to be doing the trick.

This script was working earlier and has not been updated in a little while so I imagine this was the doing of reddit's engineers for whichever reason.

@ipaqmaster ipaqmaster changed the title Appears to be suffering from an already discovered issue Downloaded images contain the text "URI signature match failed" - An issue with the links reddit provides Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant