GlobeTownDevs / api

0 stars 1 forks source link

Set up news api requests per source and test asynchronously #4

Closed marisid closed 8 years ago

marisid commented 8 years ago

Steps

  1. Make sources request
  2. From response, for each sources item, store source id into an array (e.g. "bbc-news", "mirror" etc). Optional: Save source id logo and hyperlink for displaying next to headlines
  3. For each source id in the array, make an article request, ideally using SortBy 'top' if available for that source
  4. From response, pick first 5 headlines (for testing purposes)per source and push them into a new object
  5. Pass the headlines object for Text Rasor API requests following the format below (see Nick's comment)
njsfield commented 8 years ago

JSON To Parse To TextRazor Example

A global object could hold much more information, including JSON urls to articles, urls to images/logos, date article created etc. But the core information parsed to TextRazor would appear like this:


var jsonToGoToTextRazor = {
    bbc-news: [
        'headline1 description',
        'headline2 description',
        'headline3 description'
    ],
    mirror: [
        'headline1 description',
        'headline2 description',
        'headline3 description'
    ],
    mail: [
        'headline3 description',
        'headline4 description'
    ]
}
marisid commented 8 years ago

Async tests

tbtommyb commented 8 years ago

So are we sending headlines from multiple newspapers to be analysed or are we choosing individual newspapers?

marisid commented 8 years ago

Good point @tbtommyb. The json headline object will contain headlines from a single source, as selected by the user before fetching any news feed. (update to step 3 above: make an article request for a selected source from the available sources array - maybe a dropdown list? TBC)