dqlhsm9820 2015-02-06 17:27
浏览 24

从Twitter Feed(PHP)中删除图片

I've been using TwitterOAuth for some time, so it might be a little outdated but I think that doesn't matter in this case. The problem I have is with images. When you embed an image in Twitter post, as a result I'm getting simple text link to that page on Twitter showing the picture. That link is a part of text message from the feed.

It looks like this:

Twitter message goes here, there some http://link.com. There is https://www.another-link.net/blabla/. Love you all. https://twitter.com/zzz/status/123123132132/photo/1

I'd like to strip those picture-links out of the text feed I'm reading by PHP. It could be as simple as strip links containing "/photo/". However, Twitter wraps all links, including those, in T.CO (link shortening tool). So all the links look like http://t.co/ZZZ0123ZZZ

Twitter message goes here, there some http://t.co/abc. There is http://t.co/def. Love you all. http://t.co/ghi

That prevents me from simple search & replace. I don't know which link is a real link and which is an image-link. I can't strip the last link either because there might not be any image and the last link could be a real link to something I'd like to keep.

Is there any way to strip those image links? Other than actually follow the link with curl or something, so I know where it leads.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?