A Python crawler project for Beginners: Build an English vocabulary test script!

Source: Internet
Author: User

Recently friends in hard study English, but do not know how to learn how, until one day, he found the scallop nets, there is a "assessment of your Word volume" function very good, recommended to me!


Today we will use Python to make a small crawler, and then write a script to achieve this function!

Objective: To create an English vocabulary test script

URL: Scallop Mesh

Tools: python3.6, Pycharm, requests library

Ideas:

As with Web pages, there are three steps in total:


Take a look at the data on the Web page and grab the bag with the F12 developer tool to

For a better presentation, the pages here are shrinking.


Click Start, and look at what's coming up.


Here we caught a package, this JSON data contains all the categories or levels, altogether ten categories, we click "Response" Verification


As you can see, the display is in the JSON data we caught, but the contents of 0 and 1 are the same, and some are different. Don't worry, we first choose ' College entrance Examination ', in grasping the bag to see
After choosing the college entrance examination, the Web page gives a second step, 50 words to choose, note, first look at the real address of the JSON data caught
Do you remember the bag we caught at the first step? 0 inside is the value of the last category of the real address, 1 inside is the corresponding display in the content of the page, OK, the second step of the real URL is also we find the law, that down is the analysis of the word, see what the law, we point to open a look
There are several values that are important and our goal:

The content value is the displayed word

Definition_choices is a multi-word meaning that needs our judgment, the middle contains the correct meaning, and the rank value in each meaning should be the mark of the meaning.

The rank value is the correct meaning, and thus the correct meaning in the above-mentioned meanings.

OK, here we can start to write code, the specific process is not explained, no anti-crawling, all JSON data read and judge, first put my code and run the effect


Python Learning Communication Group 542110741

Please ignore my slag of English level and layout


Because this site is very simple, just grab the package can get all the data, no anti-crawling, so, is also a good place for our novice practiced hand, we can try, if there is a more beautiful script, welcome everyone in the comment area to share!

A Python crawler project for Beginners: Build an English vocabulary test script!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.