Use Python to explore all the character information of Yuanshin, download and save in batches

Python batch acquisition of original god role information

preamble

Yuanshin is an open world adventure game produced and released by Mihayou. It claims to have 56 million players worldwide. It can be said to be very popular. My friends say it’s fun. Hey, but I just don’t play it.

However, today I will use python to open the door of "Original God World"! Explore the game characters!

Without further ado, let's start straight away!

Preparation

This is the tool you need to use this time

  • nodejs
  • pyexecjs
  • requests

Editor: pycharm
Environment: Python 3.8

code display

import requests
import re
import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")
import execjs
 
url = 'https://ys.防止不过审,网址屏蔽了,大家自己改成官网.com/main/character/liyue?char=1'
html_data = requests.get(url).text
js_text = re.findall('window.__NUXT__=(.*);', html_data)[0]
result = execjs.eval(js_text)
# pprint.pprint(result)
charList = result['data'][0]['charList']
for char in charList:
    cover1 = char['cover1']
    title = char['title']
    intro = char['intro']
    audio_list = char['cv'][0]['audio']
    print(title, intro, cover1, audio_list)

at last

Some people may not know what the article talks about, so I specially recorded a detailed video explanation, put it together with the code, and directly scanned the business card at the end of the article to get it.

This is the end of today's sharing, see you next time! Remember to like and bookmark to prevent losing contact!

Author: Hi Learning Programming
CSDN: https://blog.csdn.net/fei347795790
This article is only for communication and learning. Without the author's permission, reprinting is prohibited, let alone other purposes, and offenders will be held accountable.

Guess you like

Origin blog.csdn.net/fei347795790/article/details/129165154