如何从archive.org API获取下一行50行

时间:2018-03-02 20:55:27

标签: api

我正在使用archive.org获取有声读物,现在我想加载下50个结果我怎么能做到这一点?我当前的连接URL在这里,它只检索前50个结果

val LIBRIVOX_URL = "https://archive.org/advancedsearch.php?q=subject%3A%22librivox%22+AND+mediatype%3Aaudio&fl[]=avg_rating&fl[]=publisher&fl[]=description&fl[]=downloads&fl[]=identifier&fl[]=mediatype&fl[]=num_reviews&fl[]=title&sort[]=&sort[]=&sort[]=&rows=50&page=1&output=json&callback=callback&save=yes"

1 个答案:

答案 0 :(得分:-1)

希望这会对您有帮助,您可以使用您的网址在结果中选择要返回的行数,例如:http://localhost:9000/100'将返回100个结果'

以下是代码:

app.get('/:id', (req, res) => {
    let rows = req.params.id;
    let mediatype = 'audio';
    let archiveUrl = `https://archive.org/advancedsearch.php?q=subject%3A%22librivox%22+AND+mediatype%3A${mediatype}&fl[]=avg_rating&fl[]=publisher&fl[]=description&fl[]=downloads&fl[]=identifier&fl[]=mediatype&fl[]=num_reviews&fl[]=title&sort[]=&sort[]=&sort[]=&rows=${rows}&page=1&output=json`
    axios.get(archiveUrl)
    .then(elem => {
        res.json(elem.data.response.docs);
    })
})