Twitter头像图片图像现在在大多数域中都被阻止 [英] Twitter profile picture images now blocked on most domains
问题描述
在此基于此答案:构建Twitter个人资料图像网址使用Twitter用户ID
我为客户的网站实现了一些功能,该功能显示了Twitter个人资料图片的img,因此可以显示在我们的网站上. ( https://twitter.com/[screen_name]/profile_image?size=orriginal)
I implemented some functionality for a client's website that showed a Twitter profile picture's img so it could be displayed on our site. ( https://twitter.com/[screen_name]/profile_image?size=original )
不幸的是,在几个星期后返回该项目后,Twitter似乎已阻止了此功能.查看响应标头,我看到:
Unfortunately after coming back to the project after a couple weeks it looks like Twitter has now blocked this functionality. Looking at the response headers I see:
稍加拨动之后,看起来像content-security-policy
,也许还有x-frame-options
设置正在阻止该功能现在起作用.我的假设是否正确,是否有任何解决方法(除了使用API通过以下API获取个人资料图片网址外:
After poking around a bit it looks like the content-security-policy
and perhaps also the x-frame-options
settings are preventing the functionality from working now. Am I correct in my assumption and are there any workarounds (other than using the API to get the profile image url via this API: https://developer.twitter.com/en/docs/accounts-and-users/user-profile-images-and-banners )
推荐答案
API是获取这些URL和图像的正确方法.您执行此操作的方式永远不会是记录或支持的获取个人资料图像的方式.当前的方法尚无解决方法,您应该使用官方的API.
The API is the correct way to obtain these URLs and images. The way you were doing it was never a documented or supported manner of getting profile images. There’s no workaround for your current method, you should use the official API.
这篇关于Twitter头像图片图像现在在大多数域中都被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!