mozilla / chronicle

find everything you've ever found
http://mozillachronicle.tumblr.com/
Mozilla Public License 2.0
16 stars 6 forks source link

Screenshot URL should be on the user page rather than visit #264

Open nchapman opened 9 years ago

nchapman commented 9 years ago

The /v1/visits endpoint includes the screenshot URL as part of the visit rather than the embedded userPage. It should be moved into the userPage and renamed from screenshot_url to screenshotUrl. The /v1/search endpoint correctly embeds the screenshot URL in the user page data, but it should also be renamed to screenshotUrl.

Example of the current json:

[
  {
    "id": "811b32d1-63ae-4b21-b2d3-189b2d86a7e6",
    "url": "http://espn.go.com/",
    "title": "ESPN: The Worldwide Leader In Sports",
    "visitedAt": "2015-01-01T22:11:23.795Z",
    "userPage": {
      "userId": "a6c9411418f94710a712ab97e7a3541c",
      "userPageId": "08f3771f-1d09-4bc5-baac-599edd44189b",
      "updatedAt": "2015-01-31T23:10:36.473Z",
      "rawUrl": "http://espn.go.com/",
      "urlHash": "255fdc0bee3fec1487ae4545b79e4d8fe96b6cb2",
      "extractedAt": "2015-01-31T23:10:36.473Z",
      "extractedAuthorName": null,
      "extractedAuthorUrl": null,
      "extractedCacheAge": "10392",
      "extractedContent": null,
      "extractedDescription": "ESPN.com provides comprehensive sports coverage. Complete sports information including NFL, MLB, NBA, College Football, College Basketball scores and news.",
      "extractedFaviconColor": "{\"204\",\"0\",\"2\"}",
      "extractedFaviconUrl": "http://espn.go.com/favicon.ico",
      "extractedImageCaption": null,
      "extractedImageColor": null,
      "extractedImageEntropy": null,
      "extractedImageHeight": 342,
      "extractedImageUrl": "http://a.espncdn.com/photo/2015/0130/nba_g_cole_b1_608x342.jpg",
      "extractedImageWidth": 608,
      "extractedLanguage": "English",
      "extractedLead": null,
      "extractedMediaDuration": null,
      "extractedMediaHeight": null,
      "extractedMediaHtml": null,
      "extractedMediaType": null,
      "extractedMediaWidth": null,
      "extractedProviderDisplay": "espn.go.com",
      "extractedProviderName": "Go",
      "extractedProviderUrl": "http://espn.go.com",
      "extractedPublished": null,
      "extractedSafe": true,
      "extractedTitle": "ESPN: The Worldwide Leader In Sports",
      "extractedType": "html",
      "extractedUrl": "http://espn.go.com/",
      "createdAt": "2015-01-31T23:10:36.284Z"
    },
    "screenshot_url": "//api.url2png.com/v6/P545C07160BD2A/4fb54c42c66d2aed0bfa1b85e25a2a85/png/?url=http%3A%2F%2Fespn.go.com%2F&viewport=1024x683&thumbnail_max_width=540"
  }
]
pdehaan commented 9 years ago

What's this?

"extractedFaviconColor": "{\"204\",\"0\",\"2\"}",

Looks like a weird string representation of a... something that isn't quite an object or array.

nchapman commented 9 years ago

Another field to check: looks like it's url in the search endpoint and rawUrl for userPage in visits.

jaredhirsch commented 9 years ago

@nchapman Do you want to convert this to a more general "things to fix in the API" bug? If so, maybe we fold this under #222?

jaredhirsch commented 9 years ago

wherever the list of grievances winds up, we should really not be forcing the front-end to do stuff like

if (response && response.results && response.results.hits) {

So we need to simplify the search response to return an object with (1) some metadata, and (2) a results object that contains well-defined Visit or UserPage datatypes