1

So basically I've been trying to fetch the wallpaper links from reddit.com/r/wallpapers and use them in some images in a vue file using axios. However, when retrieving, the preview links (postObjList[0].data.preview.images[0].source.url) are giving me the above-mentioned error, even when I try to manually enter them on my chrome address bar. What is wrong and how to solve this?

<template>
      <div class="hello">
        <img id= "test" src="" alt="">
      </div>
    </template>

    <script>

    const axios = require('axios')
    export default {
      name: 'HelloWorld',
      props: {
        msg: String
      },
      created() {
        axios.get('https://www.reddit.com/r/wallpapers.json')
        .then(response => {
          let postObjList = response.data.data.children
          console.log(postObjList)
          let thumbnail = postObjList[0].data.preview.images[0].source.url
          console.log(thumbnail)
          document.getElementById("test").src = thumbnail
        })
      }
    }
Shiladitya Bose
  • 893
  • 2
  • 13
  • 31

1 Answers1

1

Got an old reddit thread that already answered the same problem. reddit link

As to why &amp; is causing 403 error is unclear to me. However, Why use &amp provides useful information.

Linking another post about similar issue for future reference.

Shiladitya Bose
  • 893
  • 2
  • 13
  • 31