Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to collect all kinds of information about Marvel through Marvel API

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to collect all kinds of information about Marvel through Marvel API. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

The interface we are going to talk about today is called "powerful" because the content it returns contains unknown energy so large that it can easily destroy the universe N times.

Yes, this is the API that Marvel opens to developers.

Official website address:

Https://developer.marvel.com/

The content covered by the data is mainly Marvel-related cartoon information, including:

1491 roles

43759 comic books

6200 creators

10713 series

96740 stories

75 events

And the correlation between these data. For example, you can find out the events through a character, or the characters in which a creator has been involved.

I made a simple demonstration to query the relevant roles by name:

And query the cartoons that appear through the character ID:

Marvel API is not a completely public visit, you need to apply first, but there is no threshold (as long as you can read English). When using the API, the general operation is to encrypt the applied public key, key and timestamp with MD5 in accordance with the official method, put it in the parameters as permission verification, and make the request through GET (you can use requests).

I use a third-party encapsulated Python library marvel here, which saves a lot of work, so the core code is very simple:

Import marvel

From IPython.display import Image, HTML, display

PUBLIC_KEY = 'your public key'

PRIVATE_KEY = 'your private key'

M = marvel.Marvel (PUBLIC_KEY, PRIVATE_KEY)

Characters = m.characters

Name = input ('Please enter the hero to query (English, but only the beginning):')

Print ('searching...')

All_characters = characters.all (nameStartsWith=name)

Address of the third party library:

Https://pypi.org/project/marvel/

This API of Marvel, I think it is a very good tool for practicing hands. As a learner, you can learn from using:

Use of public key, private key, MD5 encryption (interface permission verification)

The call of API, the passing of parameters, the processing of the data returned by JSON

Collation and analysis of multi-dimensional data

Also, the reading of English documents

To my regret, there is not much data about heroic roles in the data, otherwise it would be even more interesting.

For the application of this interface, I have several ideas for reference:

Make an enthusiast website or Mini Program to provide retrieval and collation and display of the data.

Data analysis to see which roles are the most popular, which authors are the most diligent, the relationships between roles, etc.

Mini Game, such as collecting cards. (non-commercial, of course)

I also recommended Douban's API earlier, but now that Douban has taken the developer page offline, it is impossible to see the specific API description, and it is difficult to say whether Douban will be closed to the public after that. Marvel API is more complicated than Douban API, mainly in the part of authority authentication. In addition, there are some requirements in use, if you display the work later, please pay attention to:

The maximum number of requests is 1000 / day (but it is 3000 on my personal page), and the request source URL (referrer) needs to be set. It is recommended to reduce the number of requests through self-built cache.

You need to mark "Data provided by Marvel. ©2014 Marvel" on all pages that use interface data

Need to provide anti-link (http://marvel.com) to Marvel official website.

The image URL in the returned API is not directly accessible. You need to add the required image size and file type to spell out the complete path.

All kinds of information about how to collect Marvel through Marvel API is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report