【问题标题】:how to parse copy link of twitter如何解析推特的复制链接
【发布时间】:2022-01-27 00:40:24
【问题描述】:

我正在使用此代码-:

private static func getJson(_ link: String, completion: @escaping (Json?) -> ()) {
    let url = URL(string: "https://twitter.com/BCCI/status/1476041561288822788?s=20")!
    URLSession.shared.dataTask(with: url) { data, response, error in
        guard let data = data, error == nil else {
            return completion(nil)
        }
        if let json = (try? JSONSerialization.jsonObject(with: data)) as? Json {
            completion(json)
        } else {
            completion(nil)
        }
    }.resume()
}

我要获取json数据并下载链接

【问题讨论】:

标签: swift twitter


【解决方案1】:

如果我们查看 Twitter 文档 here,您会发现它需要身份验证,因此在拨打电话时会出错。

Auth: Twitter Oauth 1.0, app-only or app-user

Twitter getting started 链接可能对进行设置很有用,它是相当不言自明的,并且是一步一步进行的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-01
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 2019-11-20
    • 2012-10-09
    • 2020-09-20
    相关资源
    最近更新 更多