ceoldevs / scis-website

0 stars 1 forks source link

Dynamically fetch faculty's research #6

Closed smc181002 closed 1 year ago

smc181002 commented 1 year ago

✨ DBLP RSS is one solution that can be used to fetch this information

🐛 DBLP RSS is failing to fetch (request timeout) for an unknown reason.

smc181002 commented 1 year ago

👔 Scopus API has worked (Requires college internet to work)

API: https://api.elsevier.com/content/search/scopus?query=${searchQuery}&apiKey=${apiKey}

const url = `https://api.elsevier.com/content/search/scopus?query=${searchQuery}&apiKey=${apiKey}`

try {
    let res = await fetch(url);
    let json = await res.json();
    let entries = json['search-results'].entry.slice(0,10);

    let formatedEntries = entries.map(entry => {
        return {
            title: entry['dc:title'],
            publication: entry['prism:publicationName'],
            id: entry['dc:identifier'],
            url: entry['prism:url'],
            type: entry['prism:aggregationType'],
            subType: entry.subtypeDescription,
            link: entry.link,
        }
    })

    console.dir(formatedEntries);
} catch (e) {
    throw e;
}

Output:

[
  {
    title: 'Two heuristic approaches for clustered traveling salesman problem with d-relaxed priority rule',
    publication: 'Expert Systems with Applications',
    id: 'SCOPUS_ID:85151540880',
    url: 'https://api.elsevier.com/content/abstract/scopus_id/85151540880',
    type: 'Journal',
    subType: 'Article',
    link: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  {
    title: 'An evolutionary approach comprising tailor-made variation operators for rescue unit allocation and scheduling with fuzzy processing times',
    publication: 'Engineering Applications of Artificial Intelligence',
    id: 'SCOPUS_ID:85153529627',
    url: 'https://api.elsevier.com/content/abstract/scopus_id/85153529627',
    type: 'Journal',
    subType: 'Article',
    link: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  {
    title: 'Evolutionary approaches for the weighted anti-covering location problem',
    publication: 'Evolutionary Intelligence',
    id: 'SCOPUS_ID:85124589280',
    url: 'https://api.elsevier.com/content/abstract/scopus_id/85124589280',
    type: 'Journal',
    subType: 'Article',
    link: [ [Object], [Object], [Object], [Object] ]
  },
  ...
  ...
  ...
]

We can fetch more entries - API Doc - https://dev.elsevier.com/documentation/ScopusSearchAPI.wadl

Here is an example - https://dev.elsevier.com/payloads/search/scopusSearchResp.json

smc181002 commented 1 year ago

elsevier's guidelines restrict the api to be used in the client side only

Image

This will restrict the performance of the website and SEO

smc181002 commented 1 year ago

Currently fetching from personal strapi database