Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support of TINAMI #117

Merged
merged 2 commits into from Feb 6, 2017
Merged

add support of TINAMI #117

merged 2 commits into from Feb 6, 2017

Conversation

@shuuji3
Copy link
Contributor

@shuuji3 shuuji3 commented Jan 21, 2017

TINAMI is one of famous Japanese illustration community for fans of anime and comics like Pixiv.

To use TINAMI API, we need to get TINAMI API key. Could you make a request for TINAMI API? It's not difficult and I think it takes only a few minutes. Here is workflow needed:

  1. Register to TINAMI.
  2. Make a request for TINAMI API.
  3. Edit config/default.js to add a given key to Client.APIs.tinami. That's all.

You can easily register to TINAMI via Twitter account, and fill forms in API Request Form.

I translated API Request form and API Guideline to English for your reference. Visit here: https://gist.github.com/shuuji3/a7185b39c5c73a2ddbeb54682b1f81c8

You can test TINAMI provider by searching for @tinami_hot.

I added xml-js(a XML parser) to packages.json, because TINAMI API only supports XML response.

I'm inexperienced with JavaScript, feel free to give a comment if I made something wrong!

Thank you.

[TINAMI](https://tinami.com) is one of famous Japanese illustration community for fans of anime and comics like Pixiv.
@eramdam
Copy link
Owner

@eramdam eramdam commented Jan 21, 2017

Will take a look later in the day

re: /(?:www.tinami.com\/view|tinami.jp\/)/,
default: true,
callback: url => {
let imageId = url.slice(url.lastIndexOf('/') + 1);

This comment has been minimized.

@eramdam

eramdam Jan 22, 2017
Owner

I'd prefer if you used the URL API to get this. It would be less error-prone.

.then(json => {
// Quit if there is non-public image or no image
if (json.rsp._attributes.stat != 'ok' ||
json.rsp.content._attributes.type == 'novel') {

This comment has been minimized.

@eramdam

eramdam Jan 22, 2017
Owner

Please use !== and === for comparison

@shuuji3
Copy link
Contributor Author

@shuuji3 shuuji3 commented Jan 22, 2017

Thank you for the review. 😄

I've fixed my code following your advice like this:
url.slice(url.lastIndexOf('/') + 1)
new URL(url).pathname.split('/').pop()
Is it right?

In addition to that, fix the API endpoint for image to use HTTPS protocol. This prevents "Mix content warning" in the console.

@eramdam eramdam merged commit d814e9b into eramdam:master Feb 6, 2017
@shuuji3 shuuji3 deleted the shuuji3:add-thumbnail-tinami branch Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.