junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.58k stars 135 forks source link

forbidden when access image candidates url from threads #41

Closed gadingnst closed 1 year ago

gadingnst commented 1 year ago

maybe it's not an issue. but currently, I can't load any image candidates url, do you have any suggestions to solve this?

Screenshot 2023-07-08 at 13 28 38

BTW, thanks for the API! 🔥

junhoyeo commented 1 year ago

Hi, @gadingnst! Nice to see you experimenting. 👍 You need to proxy requests using a separate server. If you're using Next.js >= 12.3, you can use <Image /> and the config images.remotePatterns like the following:

/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**.cdninstagram.com',
      },
      {
        protocol: 'https',
        hostname: '**.fbcdn.net',
      },
    ],
  },
};

module.exports = nextConfig;

If not, you should use/implement something like Blazity/next-image-proxy.

gadingnst commented 1 year ago

solved. thanks, mate.