Как очистить результаты поисковой системы DuckDuckGo в React
Я могу получить результат поиска DuckDuckGo из
https://api.duckduckgo.com/
в моем проекте react.js. Но поскольку он дает нам только результаты мгновенного ответа, я не могу получить полный результат поиска.
Вот код, который я получаю в результате поиска:
import React, { Component } from 'react';
import { render } from 'react-dom';
import axios from 'axios';
interface AppProps { }
interface AppState {
name: string;
}
class App extends Component<AppProps, AppState> {
constructor(props) {
super(props);
this.state = {
name: 'React',
query: '',
img: "",
};
}
search = () => {
const options = {
method: 'GET',
url: 'https://api.duckduckgo.com/',
params: {
q: this.state.query,
no_redirect: '1',
no_html: '1',
skip_disambig: '1',
format: 'json'
},
};
axios.request(options).then((res) => {
const b = res.data; // Search result is not satisfied for me
if(b.Abstract != "") {
this.setState({
img: b.Image
})
}
}).catch(function (error) {
console.error(error);
});
}
render() {
return (
<div>
<Hello name={this.state.name} />
<p>
Start editing to see some magic happen :)
</p>
<input type="text" onChange={(e) => this.setState({query: e.target.value})} />
<button type="button" onClick={this.search.bind(this)} >Search </button>
{ this.state.img !== "" && (<img src={`https://duckduckgo.com${this.state.img}`} alt="" />) }
</div>
);
}
}
render(<App />, document.getElementById('root'));
Есть ли способ получить полные результаты, аналогичные сканированию страницы результатов поиска в Интернете?