Location>code7788 >text

Crawler practice] - the use of bs4 and sqlalchemy operation mysql database, the realization of the website multi-line data table crawling data

Popularity:881 ℃/2024-08-28 19:18:01

preamble

This article picks up where the previous one left off, and builds on it by crawling the site's multi-line table data, as well as writing the data to a mysql database

catalogs

  • First, locate the form to find the elements
  • II. Extraction of data
  • Third, write mysql database
  • IV. Appendices

First, locate the form to find the elements

First of all, open the site, as shown in the figure need to crawl multi-line data form, the use of finding elements to locate, look at the figure in the analysis that I want to crawl under the td data under the tr, so the first check to find tr line

    def script(self).
        # First locate the tr row element
        trs = ().select('.content>table>tbody>tr')
        print(trs)
[View the results of the run: Click to view the code]
[<tr><td align="center" colspan="8">2024surname Nian8moon27Tianjin hot rolled coil prices today's quotation table(meso- (chemistry))_最meso- (chemistry)prices行情走势</td></tr>, <tr><td>brand name</td><td>norm(mm)</td><td>material (that sth is made of)</td><td>the source (of a product)</td><td>prices(unit of money (in PRC: Chinese yuan, in USA: dollar, etc)/ton (loanword))</td><td>rise or fall in price</td><td>note</td></tr>, <tr><td>hot-rolled coil</td><td>2.0*1250*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3320</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.5*1250*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3270</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>2.5*1250*C</td><td>Q235B</td><td>Tonggang</td><td>3260</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.5*1250*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3270</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>2.75*1250*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3210</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3210</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3210</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3210</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>2.75*1500*C</td><td>Q235B</td><td>Tonggang</td><td>3200</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.0*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3190</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.0*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3190</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.0*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3190</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>3.0*1500*C</td><td>Q235B</td><td>Tonggang</td><td>3180</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.5*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.5*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.5*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>3.5*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.5*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3170</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>3.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>3.75*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>3.75*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.5*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.5*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.5*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>4.5*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.5*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>4.75*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.5*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td> </td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.5-11.75*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Hesteel Chengsteel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Hesteel Tangshan Steel</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Shougang</td><td>3160</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Honsteel</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1500*C</td><td>Q235B</td><td>Cangzhou China Railway</td><td>3150</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*1800*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3290</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*1800*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3290</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*1800*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3300</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>5.75*2000*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3310</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>7.75*2000*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3310</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.5*2000*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3310</td><td>distend10</td><td></td></tr>, <tr><td>hot-rolled coil</td><td>13.75*2000*C</td><td>Q235B</td><td>Baosteel, China's largest steel maker</td><td>3310</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>4.75*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>4.75*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>4.75*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>4.75*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>4.75*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.5*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.5*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.5*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.5*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.5*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.75*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.75*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td> </td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.75*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td> </td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.75*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>5.75*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>11.75*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>11.75*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>11.75*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>11.75*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>11.75*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1500*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1500*C</td><td>Q355B</td><td>Hesteel Chengsteel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1500*C</td><td>Q355B</td><td>Hesteel Tangshan Steel</td><td>3340</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1500*C</td><td>Q355B</td><td>Tonggang</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1500*C</td><td>Q355B</td><td>Honsteel</td><td>3330</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>7.75*1800*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3520</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*1800*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3520</td><td>distend10</td><td> </td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.5*1800*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3520</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*1800*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3520</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>7.75*2000*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3530</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>9.75*2000*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3530</td><td>distend10</td><td> </td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.5*2000*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3530</td><td>distend10</td><td></td></tr>, <tr><td>Low Alloy Sheet and Coil</td><td>13.75*2000*C</td><td>Q355B</td><td>Baosteel, China's largest steel maker</td><td>3530</td><td>distend10</td><td></td></tr>]

II. Extraction of data

We can see the crawl out of each line of tr and tr below the td data, the next use of the for loop to tr each line of the text extracted, but the first two lines is I do not need, I only need the third line after the data


The code is as follows:

    def __init__(self).


        # = "/Owen-ET/p/"
         = "/j/"
        # url = ""
         = {
            "quote": []
        }


    def script(self).

        trs = ().select('.content>table>tbody>tr')
        print(trs)
        print("========================= code here ↓ ========================================")
        for tr in trs: if (tr !
            if (tr ! = trs[0]) & (tr ! = trs[1]): if (tr ! = trs[0])&(tr !
                movie = {}
                infos = list(tr.stripped_strings)
                print(infos) # Output ①: Iterate through the values in trs to form an array.
                movie['pin_name'] = infos[0]
                movie['guige'] = infos[1]
                movie['caizhi'] = infos[2]
                movie['chandi'] = infos[3]
                movie['jiage'] = infos[4]
                movie['zhangdie'] = infos[5]
                #
                ["quote"].append(movie)
        print("======================== code here ↑ =========================================")
        return # Output ②: assign key names to the elements in td array in each row to form key-value pairs.
[Output result ①: Click to view the code]
['hot-rolled coil', '2.0*1250*C', 'Q235B', 'Hesteel Chengsteel', '3320', 'distend10']
['hot-rolled coil', '2.5*1250*C', 'Q235B', 'Hesteel Tangshan Steel', '3270', 'distend10']
['hot-rolled coil', '2.5*1250*C', 'Q235B', 'Tonggang', '3260', 'distend10']
['hot-rolled coil', '2.5*1250*C', 'Q235B', 'Hesteel Chengsteel', '3270', 'distend10']
['hot-rolled coil', '2.75*1250*C', 'Q235B', 'Hesteel Chengsteel', '3210', 'distend10']
['hot-rolled coil', '2.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3210', 'distend10']
['hot-rolled coil', '2.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3210', 'distend10']
['hot-rolled coil', '2.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3210', 'distend10']
['hot-rolled coil', '2.75*1500*C', 'Q235B', 'Tonggang', '3200', 'distend10']
['hot-rolled coil', '3.0*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3190', 'distend10']
['hot-rolled coil', '3.0*1500*C', 'Q235B', 'Hesteel Chengsteel', '3190', 'distend10']
['hot-rolled coil', '3.0*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3190', 'distend10']
['hot-rolled coil', '3.0*1500*C', 'Q235B', 'Tonggang', '3180', 'distend10']
['hot-rolled coil', '3.5*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '3.5*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '3.5*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '3.5*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '3.5*1500*C', 'Q235B', 'Cangzhou China Railway', '3170', 'distend10']
['hot-rolled coil', '3.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '3.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '3.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '3.75*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '3.75*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '4.5*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '4.5*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '4.5*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '4.5*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '4.5*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '4.75*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '5.5*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '5.75*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '7.5-11.75*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '13.5*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Baosteel, China's largest steel maker', '3160', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Hesteel Chengsteel', '3160', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Hesteel Tangshan Steel', '3160', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Shougang', '3160', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Honsteel', '3150', 'distend10']
['hot-rolled coil', '13.75*1500*C', 'Q235B', 'Cangzhou China Railway', '3150', 'distend10']
['hot-rolled coil', '5.75*1800*C', 'Q235B', 'Baosteel, China's largest steel maker', '3290', 'distend10']
['hot-rolled coil', '13.5*1800*C', 'Q235B', 'Baosteel, China's largest steel maker', '3290', 'distend10']
['hot-rolled coil', '13.75*1800*C', 'Q235B', 'Baosteel, China's largest steel maker', '3300', 'distend10']
['hot-rolled coil', '5.75*2000*C', 'Q235B', 'Baosteel, China's largest steel maker', '3310', 'distend10']
['hot-rolled coil', '7.75*2000*C', 'Q235B', 'Baosteel, China's largest steel maker', '3310', 'distend10']
['hot-rolled coil', '13.5*2000*C', 'Q235B', 'Baosteel, China's largest steel maker', '3310', 'distend10']
['hot-rolled coil', '13.75*2000*C', 'Q235B', 'Baosteel, China's largest steel maker', '3310', 'distend10']
['Low Alloy Sheet and Coil', '4.75*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '4.75*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '4.75*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '4.75*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '4.75*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '5.5*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.5*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.5*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.5*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '5.5*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '5.75*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.75*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.75*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '5.75*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '5.75*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '11.75*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '11.75*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '11.75*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '11.75*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '11.75*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1500*C', 'Q355B', 'Baosteel, China's largest steel maker', '3340', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1500*C', 'Q355B', 'Hesteel Chengsteel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1500*C', 'Q355B', 'Hesteel Tangshan Steel', '3340', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1500*C', 'Q355B', 'Tonggang', '3330', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1500*C', 'Q355B', 'Honsteel', '3330', 'distend10']
['Low Alloy Sheet and Coil', '7.75*1800*C', 'Q355B', 'Baosteel, China's largest steel maker', '3520', 'distend10']
['Low Alloy Sheet and Coil', '9.75*1800*C', 'Q355B', 'Baosteel, China's largest steel maker', '3520', 'distend10']
['Low Alloy Sheet and Coil', '13.5*1800*C', 'Q355B', 'Baosteel, China's largest steel maker', '3520', 'distend10']
['Low Alloy Sheet and Coil', '13.75*1800*C', 'Q355B', 'Baosteel, China's largest steel maker', '3520', 'distend10']
['Low Alloy Sheet and Coil', '7.75*2000*C', 'Q355B', 'Baosteel, China's largest steel maker', '3530', 'distend10']
['Low Alloy Sheet and Coil', '9.75*2000*C', 'Q355B', 'Baosteel, China's largest steel maker', '3530', 'distend10']
['Low Alloy Sheet and Coil', '13.5*2000*C', 'Q355B', 'Baosteel, China's largest steel maker', '3530', 'distend10']
['Low Alloy Sheet and Coil', '13.75*2000*C', 'Q355B', 'Baosteel, China's largest steel maker', '3530', 'distend10']
[Output Result ②: Click to view code]
{'quote': [{'pin_name': 'hot-rolled coil', 'guige': '2.0*1250*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3320', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.5*1250*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3270', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.5*1250*C', 'caizhi': 'Q235B', 'chandi': 'Tonggang', 'jiage': '3260', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.5*1250*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3270', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.75*1250*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3210', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3210', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3210', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3210', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '2.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Tonggang', 'jiage': '3200', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.0*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3190', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.0*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3190', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.0*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3190', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.0*1500*C', 'caizhi': 'Q235B', 'chandi': 'Tonggang', 'jiage': '3180', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3170', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '3.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '4.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.5-11.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Shougang', 'jiage': '3160', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Honsteel', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1500*C', 'caizhi': 'Q235B', 'chandi': 'Cangzhou China Railway', 'jiage': '3150', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*1800*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3290', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*1800*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3290', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*1800*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3300', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '5.75*2000*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3310', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '7.75*2000*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3310', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.5*2000*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3310', 'zhangdie': 'distend10'}, {'pin_name': 'hot-rolled coil', 'guige': '13.75*2000*C', 'caizhi': 'Q235B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3310', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '4.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '4.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '4.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '4.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '4.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.5*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.5*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.5*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.5*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.5*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '5.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '11.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '11.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '11.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '11.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '11.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Chengsteel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Hesteel Tangshan Steel', 'jiage': '3340', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Tonggang', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1500*C', 'caizhi': 'Q355B', 'chandi': 'Honsteel', 'jiage': '3330', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '7.75*1800*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3520', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*1800*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3520', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.5*1800*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3520', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*1800*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3520', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '7.75*2000*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3530', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '9.75*2000*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3530', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.5*2000*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3530', 'zhangdie': 'distend10'}, {'pin_name': 'Low Alloy Sheet and Coil', 'guige': '13.75*2000*C', 'caizhi': 'Q355B', 'chandi': 'Baosteel, China's largest steel maker', 'jiage': '3530', 'zhangdie': 'distend10'}]}

Third, write mysql database

Write the data extracted in the previous step to the mysql database using the sqlalchemy operation, first prerequisite

    def mysql(self).

        # Replace with your database connection information
        DATABASE_URI = 'mysql+pymysql://root:1234567@localhost:3306/baojia'

        # Create the database engine
        engine = create_engine(DATABASE_URI)
        session = sessionmaker(bind=engine)
        session = Session()

        # Define the JSON data and table structure
        json_data = ()['quote']

        # Assume you have a table named users
        metadata = MetaData(bind=engine)
        users_table = Table('banjuan', metadata, autoload_with=engine)

        # Parse the JSON data and insert it into the database
        for entry in json_data.
            ins = users_table.insert().values(pin_name=entry['pin_name'],
                                              guige=entry['guige'],
                                              caizhi=entry['caizhi'],
                                              chandi=entry['chandi'],
                                              jiage=entry['jiage'],
                                              zhangdie=entry['zhangdie'])
            (ins)

        # Submit changes
        ()

Configure database parsing: 'mysql+pymysql://root:1234567@localhost:3306/baojia'
You can refer to my related article that also explains it:Owen_ET-《Test platform development] ---05Flask back-end api development practice (II) -- SqlAlchemy*****

【mysql】:mysql database used

【pymysql】: Engine using pymysql

【://scott】: database username

[:tiger]: database password

[:@localhost]: database address

[ /foo]: database library name

Manually create the table structure: database name [baojia], table name [banjuan], as well as the type of each field value, length, etc.

where id is set to auto-increment and set to key

[Running results: view database]

After running it, the data from the mysql database is plugged in

[complete code]

import re
import json
import requests
from bs4 import BeautifulSoup as bs
from import sessionmaker
from sqlalchemy import create_engine, Table, MetaData


class BS.


    def __init__(self).


        # = "/Owen-ET/p/"
         = "/j/"
        # url = ""
         = {
            "quote": []
        }



    def soup(self).

        res = ()
        soup = bs(, '')
        return soup


    def script(self).

        trs = ().select('.content>table>tbody>tr')
        print(trs)
        print("=================================================================")
        print("=================================================================")
        for tr in trs: if (tr !
            if (tr ! = trs[0])&(tr ! = trs[1]): if (tr ! = trs[0])&(tr !
                movie = {}
                infos = list(tr.stripped_strings)
                print(infos)
                movie['pin_name'] = infos[0]
                movie['guige'] = infos[1]
                movie['caizhi'] = infos[2]
                movie['chandi'] = infos[3]
                movie['jiage'] = infos[4]
                movie['zhangdie'] = infos[5]
                ["quote"].append(movie)
        print("=================================================================")
        print("=================================================================")
        return

    def data(self).

        # Generate json file
        with open("quote.json", 'w', encoding='utf8') as f.
            ((), f, ensure_ascii=False, indent=4)


    def mysql(self).

        # Replace with your database connection information
        DATABASE_URI = 'mysql+pymysql://root:1234567@localhost:3306/baojia'

        # Create the database engine
        engine = create_engine(DATABASE_URI)
        session = sessionmaker(bind=engine)
        session = Session()

        # Define the JSON data and table structure
        json_data = ()['quote']

        # Assume you have a table named users
        metadata = MetaData(bind=engine)
        users_table = Table('banjuan', metadata, autoload_with=engine)

        # Parse the JSON data and insert it into the database
        for entry in json_data.
            ins = users_table.insert().values(pin_name=entry['pin_name'],
                                              guige=entry['guige'],
                                              caizhi=entry['caizhi'],
                                              chandi=entry['chandi'],
                                              jiage=entry['jiage'],
                                              zhangdie=entry['zhangdie'])
            (ins)

        # Submit changes
        ()


if __name__ == '__main__'.
    print(BS().mysql())

IV. Appendices

Refer to other articles:

  • Thanks to the author:Zebra L*-《python-data-collection-bs4(crawler2)*****

  • AI Smart Answers:

from sqlalchemy import create_engine, Table, MetaData
from import sessionmaker
import json
 
# Replace with your database connection information
DATABASE_URI = 'mysql+pymysql://user:password@localhost:3306/database'
 
# Creating a Database Engine
engine = create_engine(DATABASE_URI)
Session = sessionmaker(bind=engine)
session = Session()
 
# defineJSONData and table structure
json_data = '[{"id": 1, "name": "Alice", "age": 30}, {"id": 2, "name": "Bob", "age": 25}]'
 
# Suppose you have a file namedusersone's appearance,there areid, name, agefield
metadata = MetaData(bind=engine)
users_table = Table('users', metadata, autoload_with=engine)
 
# analyzeJSONdata and insert it into the database
data = (json_data)
for entry in data:
    ins = users_table.insert().values(id=entry['id'], name=entry['name'], age=entry['age'])
    (ins)
 
# Submit changes
()