关于微信小程序云开发调用api返回内容问题?

小程序 文章 2021-03-04 10:01 407 0 全屏看文

AI助手支持GPT4.0

关于微信小程序云开发调用api返回内容问题?About WeChat applet cloud development calling api to return content?

关于微信小程序云开发调用api返回内容问题?

有这样一个问题:我使用云开发调用新闻api,但是返回的是该新闻的链接(后缀为html的新闻链接),想问一下有什么解决方案能实现,在我的小程序点击这个链接可以实现跳转到新闻界面。或者别的解决方案,就是请求新闻api能直接返回新闻的内容等信息,(有这样的api嘛?)

There is a problem: I use cloud development to call the news API, but what I return is the news link (the news link with the suffix of HTML). I want to ask what solution can be achieved. I can jump to the news interface by clicking this link in my applet. Or another solution is to request the news API to directly return the news content and other information

回答:

陈宇明:

新闻api你可以做成数据转化,把数据转化成JSON

_Skyshine:可是我得到的是新闻的URL,怎么转换
跨商通:

云函数里,看不到await的都算错。

_Skyshine:??好像问题不是出在这
跨商通:request-promise你不加上await?不管问题出在哪,这里一定出问题。
_Skyshine:这样嘛?
跨商通:百度吧。
brave:

1、如果你能配置对方的域名为业务域名的话,用webview访问;

2、不能的话,还是自己写个程序爬一下网页内的内容,再返回给前端。

_Skyshine:大佬,想问一下你说的这个“写一个程序弄一下网页的内容”需要怎么做呢?
_Skyshine:还有想问一下有没有那种api,调用可以返回新闻的信息(标题,内容,作者,时间)的而不是网址
brave:就比如你用Python爬自己需要的信息啊
brave:你自己去找找看呗

-EOF-

AI助手支持GPT4.0