我想从该网站页面源的标签获取数据(http://champion.gg/champion/Riven)。进行一些计算。
我想要获取的数据是第二个和最后一个值(在本例中为 48.94 和 55.29)
“经验率”:[46.34,48.94,50.84,53.51,]
在 matchupData.championData 区域。
<script>
matchupData.champion = {"_id":"562b18b5d3c8aea0f40127b3","key":"Riven","lastUpdated":1445606107025,"name":"Riven","roles":[{"title":"Top","role":"TOP","percentPlayed":87.22,"games":77048,"_id":"562b18b2de3868301612b093"}],"role":"TOP","roleTitle":"Top"};
matchupData.generalRole = {"_id":"562b18a8d3c8aea0f4011437","role":"TOP","matrixData":[49.7,11793.82,6.07,7.59,6.09,21182.98,28296.11],"totalNumber":52,"patchPlay":[3.84,3.84,3.84,3.84,3.84],"matrixLabels":["Win Rate","Gold Earned","Kills","Assists","Deaths","Damage Dealt","Damage Taken"]};
matchupData.championData = {"_id":"562b18a5d3c8aea0f40112ed","key":"Riven","role":"TOP","synergy":[],"adcsupport":[],"matchups":[{"games":42,"statScore":7.13,"winRate":61.9,"winRateChange":9.69,"key":"Urgot","_id":"562b18a5de38683016119b7f"},{"games":226,"statScore":7.1,"winRate":61.94,"winRateChange":9.73,"key":"Yorick","_id":"562b18a5de38683016119b7e"},{"games":233,"statScore":4.89,"winRate":51.5,"winRateChange":-0.71,"key":"Poppy","_id":"562b18a5de38683016119b7d"},{"games":68,"statScore":6.5,"winRate":51.47,"winRateChange":-0.74,"key":"Galio","_id":"562b18a5de38683016119b7c"},{"games":62,"statScore":5.02,"winRate":51.61,"winRateChange":-0.6,"key":"Cassiopeia","_id":"562b18a5de38683016119b7b"},{"games":259,"statScore":3.15,"winRate":47.87,"winRateChange":-4.34,"key":"Quinn","_id":"562b18a5de38683016119b7a"},{"games":324,"statScore":6.85,"winRate":53.39,"winRateChange":1.18,"key":"Aatrox","_id":"562b18a5de38683016119b79"},{"games":503,"statScore":6.24,"winRate":51.88,"winRateChange":-0.33,"key":"Singed","_id":"562b18a5de38683016119b78"},{"games":127,"statScore":6.33,"winRate":51.96,"winRateChange":-0.25,"key":"Kayle","_id":"562b18a5de38683016119b77"},{"games":207,"statScore":4.32,"winRate":50.72,"winRateChange":-1.49,"key":"Akali","_id":"562b18a5de38683016119b76"},{"games":57,"statScore":7.05,"winRate":56.14,"winRateChange":3.93,"key":"Karthus","_id":"562b18a5de38683016119b75"},{"games":513,"statScore":5.58,"winRate":49.9,"winRateChange":-2.31,"key":"Sion","_id":"562b18a5de38683016119b74"},{"games":385,"statScore":7.06,"winRate":54.28,"winRateChange":2.07,"key":"Trundle","_id":"562b18a5de38683016119b73"},{"games":359,"statScore":6.66,"winRate":52.64,"winRateChange":0.43,"key":"Heimerdinger","_id":"562b18a5de38683016119b72"},{"games":487,"statScore":6.86,"winRate":55.03,"winRateChange":2.82,"key":"Teemo","_id":"562b18a5de38683016119b71"},{"games":866,"statScore":6.68,"winRate":56.46,"winRateChange":4.25,"key":"Rumble","_id":"562b18a5de38683016119b70"},{"games":589,"statScore":5.8,"winRate":53.98,"winRateChange":1.77,"key":"Jayce","_id":"562b18a5de38683016119b6f"},{"games":608,"statScore":6.38,"winRate":54.11,"winRateChange":1.9,"key":"Maokai","_id":"562b18a5de38683016119b6e"},{"games":169,"statScore":5.96,"winRate":52.66,"winRateChange":0.45,"key":"Zac","_id":"562b18a5de38683016119b6d"},{"games":300,"statScore":5.34,"winRate":52,"winRateChange":-0.22,"key":"Swain","_id":"562b18a5de38683016119b6c"},{"games":818,"statScore":6.16,"winRate":56.47,"winRateChange":4.26,"key":"Ryze","_id":"562b18a5de38683016119b6b"},{"games":496,"statScore":4.95,"winRate":50.6,"winRateChange":-1.61,"key":"Volibear","_id":"562b18a5de38683016119b6a"},{"games":1337,"statScore":3.76,"winRate":47.86,"winRateChange":-4.35,"key":"Tryndamere","_id":"562b18a5de38683016119b69"},{"games":621,"statScore":3.7,"winRate":47.34,"winRateChange":-4.87,"key":"Lissandra","_id":"562b18a5de38683016119b68"},{"games":233,"statScore":6.83,"winRate":55.79,"winRateChange":3.58,"key":"Mordekaiser","_id":"562b18a5de38683016119b67"},{"games":930,"statScore":6.25,"winRate":52.47,"winRateChange":0.26,"key":"Hecarim","_id":"562b18a5de38683016119b66"},{"games":1902,"statScore":4.61,"winRate":49.63,"winRateChange":-2.58,"key":"Nasus","_id":"562b18a5de38683016119b65"},{"games":261,"statScore":7.24,"winRate":60.15,"winRateChange":7.94,"key":"Shyvana","_id":"562b18a5de38683016119b64"},{"games":1945,"statScore":7.6,"winRate":61.85,"winRateChange":9.64,"key":"Darius","_id":"562b18a5de38683016119b63"},{"games":1227,"statScore":5.71,"winRate":51.26,"winRateChange":-0.95,"key":"Chogath","_id":"562b18a5de38683016119b62"},{"games":1080,"statScore":3.93,"winRate":48.14,"winRateChange":-4.07,"key":"Kennen","_id":"562b18a5de38683016119b61"},{"games":1172,"statScore":3.25,"winRate":47.69,"winRateChange":-4.52,"key":"Pantheon","_id":"562b18a5de38683016119b60"},{"games":1827,"statScore":5.26,"winRate":50.57,"winRateChange":-1.64,"key":"Jax","_id":"562b18a5de38683016119b5f"},{"games":2057,"statScore":7.02,"winRate":53.42,"winRateChange":1.21,"key":"DrMundo","_id":"562b18a5de38683016119b5e"},{"games":2799,"statScore":4.55,"winRate":50.83,"winRateChange":-1.38,"key":"Fiora","_id":"562b18a5de38683016119b5d"},{"games":966,"statScore":5.88,"winRate":51.86,"winRateChange":-0.35,"key":"JarvanIV","_id":"562b18a5de38683016119b5c"},{"games":1341,"statScore":6.54,"winRate":52.34,"winRateChange":0.13,"key":"MonkeyKing","_id":"562b18a5de38683016119b5b"},{"games":2705,"statScore":6.51,"winRate":54.04,"winRateChange":1.83,"key":"Olaf","_id":"562b18a5de38683016119b5a"},{"games":2231,"statScore":6.72,"winRate":58.18,"winRateChange":5.97,"key":"Vladimir","_id":"562b18a5de38683016119b59"},{"games":2415,"statScore":4.47,"winRate":49.06,"winRateChange":-3.15,"key":"Shen","_id":"562b18a5de38683016119b58"},{"games":3907,"statScore":4.09,"winRate":49.73,"winRateChange":-2.48,"key":"Irelia","_id":"562b18a5de38683016119b57"},{"games":3810,"statScore":6.8,"winRate":52.86,"winRateChange":0.65,"key":"Gangplank","_id":"562b18a5de38683016119b56"},{"games":4534,"statScore":4.98,"winRate":49.16,"winRateChange":-3.05,"key":"Garen","_id":"562b18a5de38683016119b55"},{"games":4127,"statScore":6.47,"winRate":54.54,"winRateChange":2.33,"key":"Gnar","_id":"562b18a5de38683016119b54"},{"games":1036,"statScore":4.46,"winRate":50.09,"winRateChange":-2.12,"key":"Rengar","_id":"562b18a5de38683016119b53"},{"games":957,"statScore":6.23,"winRate":53.39,"winRateChange":1.18,"key":"Lulu","_id":"562b18a5de38683016119b52"},{"games":4769,"statScore":4.67,"winRate":47.74,"winRateChange":-4.47,"key":"Malphite","_id":"562b18a5de38683016119b51"},{"games":893,"statScore":7.1,"winRate":57.33,"winRateChange":5.12,"key":"Ekko","_id":"562b18a5de38683016119b50"},{"games":7623,"statScore":4.65,"winRate":50.19,"winRateChange":-2.02,"key":"Renekton","_id":"562b18a5de38683016119b4f"},{"games":1434,"statScore":6.25,"winRate":54.39,"winRateChange":2.18,"key":"TahmKench","_id":"562b18a5de38683016119b4e"},{"games":2660,"statScore":5.79,"winRate":52.63,"winRateChange":0.42,"key":"Yasuo","_id":"562b18a5de38683016119b4d"}],"unique":null,"runes":{"highestWinPercent":{"games":617,"winPercent":59.31,"runes":[{"id":5245,"number":8,"name":"Greater Mark of Attack Damage","img":"r_1_3.png","description":"+0.95 attack damage","_id":"562b18a5de38683016119ac2"},{"id":5251,"number":1,"name":"Greater Mark of Critical Chance","img":"r_3_3.png","description":"+0.93% critical chance","_id":"562b18a5de38683016119ac1"},{"id":5295,"number":6,"name":"Greater Glyph of Cooldown Reduction","img":"b_1_3.png","description":"-0.83% cooldowns","_id":"562b18a5de38683016119ac0"},{"id":5296,"number":3,"name":"Greater Glyph of Scaling Cooldown Reduction","img":"b_2_3.png","description":"-0.09% cooldowns per level (-1.67% at champion level 18)","_id":"562b18a5de38683016119abf"},{"id":5317,"number":9,"name":"Greater Seal of Armor","img":"y_1_3.png","description":"+1 armor","_id":"562b18a5de38683016119abe"},{"id":5335,"number":3,"name":"Greater Quintessence of Attack Damage","img":"bl_1_3.png","description":"+2.25 attack damage","_id":"562b18a5de38683016119abd"}]},"mostGames":{"games":8461,"winPercent":49.74,"runes":[{"id":5245,"number":9,"name":"Greater Mark of Attack Damage","img":"r_1_3.png","description":"+0.95 attack damage","_id":"562b18a5de38683016119ac6"},{"id":5289,"number":9,"name":"Greater Glyph of Magic Resist","img":"b_3_3.png","description":"+1.34 magic resist","_id":"562b18a5de38683016119ac5"},{"id":5317,"number":9,"name":"Greater Seal of Armor","img":"y_1_3.png","description":"+1 armor","_id":"562b18a5de38683016119ac4"},{"id":5335,"number":3,"name":"Greater Quintessence of Attack Damage","img":"bl_1_3.png","description":"+2.25 attack damage","_id":"562b18a5de38683016119ac3"}]}},"masteries":{"highestWinPercent":{"games":354,"winPercent":60.73,"masteries":[{"tree":"Offense","total":21,"_id":"562b18a5de38683016119af3","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119af5"},{"points":1,"mastery":4162,"_id":"562b18a5de38683016119af4"}],"row5":[{"points":0,"mastery":4151,"_id":"562b18a5de38683016119af9"},{"points":3,"mastery":4152,"_id":"562b18a5de38683016119af8"},{"points":0,"mastery":null,"_id":"562b18a5de38683016119af7"},{"points":0,"mastery":4154,"_id":"562b18a5de38683016119af6"}],"row4":[{"points":0,"mastery":4141,"_id":"562b18a5de38683016119afd"},{"points":3,"mastery":4142,"_id":"562b18a5de38683016119afc"},{"points":0,"mastery":4143,"_id":"562b18a5de38683016119afb"},{"points":1,"mastery":4144,"_id":"562b18a5de38683016119afa"}],"row3":[{"points":1,"mastery":4131,"_id":"562b18a5de38683016119b01"},{"points":1,"mastery":4132,"_id":"562b18a5de38683016119b00"},{"points":0,"mastery":4133,"_id":"562b18a5de38683016119aff"},{"points":3,"mastery":4134,"_id":"562b18a5de38683016119afe"}],"row2":[{"points":0,"mastery":4121,"_id":"562b18a5de38683016119b05"},{"points":3,"mastery":4122,"_id":"562b18a5de38683016119b04"},{"points":0,"mastery":4123,"_id":"562b18a5de38683016119b03"},{"points":0,"mastery":4124,"_id":"562b18a5de38683016119b02"}],"row1":[{"points":1,"mastery":4111,"_id":"562b18a5de38683016119b09"},{"points":0,"mastery":4112,"_id":"562b18a5de38683016119b08"},{"points":4,"mastery":4113,"_id":"562b18a5de38683016119b07"},{"points":0,"mastery":4114,"_id":"562b18a5de38683016119b06"}]}},{"tree":"Defense","total":9,"_id":"562b18a5de38683016119add","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119adf"},{"points":0,"mastery":4262,"_id":"562b18a5de38683016119ade"}],"row5":[{"points":0,"mastery":4251,"_id":"562b18a5de38683016119ae2"},{"points":0,"mastery":4252,"_id":"562b18a5de38683016119ae1"},{"points":0,"mastery":4253,"_id":"562b18a5de38683016119ae0"}],"row4":[{"points":0,"mastery":4241,"_id":"562b18a5de38683016119ae6"},{"points":0,"mastery":4242,"_id":"562b18a5de38683016119ae5"},{"points":0,"mastery":4243,"_id":"562b18a5de38683016119ae4"},{"points":0,"mastery":4244,"_id":"562b18a5de38683016119ae3"}],"row3":[{"points":0,"mastery":4231,"_id":"562b18a5de38683016119aea"},{"points":1,"mastery":4232,"_id":"562b18a5de38683016119ae9"},{"points":0,"mastery":4233,"_id":"562b18a5de38683016119ae8"},{"points":0,"mastery":4234,"_id":"562b18a5de38683016119ae7"}],"row2":[{"points":1,"mastery":4221,"_id":"562b18a5de38683016119aee"},{"points":3,"mastery":4222,"_id":"562b18a5de38683016119aed"},{"points":0,"mastery":null,"_id":"562b18a5de38683016119aec"},{"points":0,"mastery":4224,"_id":"562b18a5de38683016119aeb"}],"row1":[{"points":2,"mastery":4211,"_id":"562b18a5de38683016119af2"},{"points":0,"mastery":4212,"_id":"562b18a5de38683016119af1"},{"points":2,"mastery":4213,"_id":"562b18a5de38683016119af0"},{"points":0,"mastery":4214,"_id":"562b18a5de38683016119aef"}]}},{"tree":"Utility","total":0,"_id":"562b18a5de38683016119ac7","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119ac9"},{"points":0,"mastery":4362,"_id":"562b18a5de38683016119ac8"}],"row5":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119acc"},{"points":0,"mastery":4352,"_id":"562b18a5de38683016119acb"},{"points":0,"mastery":4353,"_id":"562b18a5de38683016119aca"}],"row4":[{"points":0,"mastery":4341,"_id":"562b18a5de38683016119ad0"},{"points":0,"mastery":4342,"_id":"562b18a5de38683016119acf"},{"points":0,"mastery":4343,"_id":"562b18a5de38683016119ace"},{"points":0,"mastery":4344,"_id":"562b18a5de38683016119acd"}],"row3":[{"points":0,"mastery":4331,"_id":"562b18a5de38683016119ad4"},{"points":0,"mastery":4332,"_id":"562b18a5de38683016119ad3"},{"points":0,"mastery":4333,"_id":"562b18a5de38683016119ad2"},{"points":0,"mastery":4334,"_id":"562b18a5de38683016119ad1"}],"row2":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119ad8"},{"points":0,"mastery":4322,"_id":"562b18a5de38683016119ad7"},{"points":0,"mastery":4323,"_id":"562b18a5de38683016119ad6"},{"points":0,"mastery":4324,"_id":"562b18a5de38683016119ad5"}],"row1":[{"points":0,"mastery":4311,"_id":"562b18a5de38683016119adc"},{"points":0,"mastery":4312,"_id":"562b18a5de38683016119adb"},{"points":0,"mastery":4313,"_id":"562b18a5de38683016119ada"},{"points":0,"mastery":4314,"_id":"562b18a5de38683016119ad9"}]}}]},"mostGames":{"games":8913,"winPercent":51.91,"masteries":[{"tree":"Offense","total":21,"_id":"562b18a5de38683016119b36","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119b38"},{"points":1,"mastery":4162,"_id":"562b18a5de38683016119b37"}],"row5":[{"points":0,"mastery":4151,"_id":"562b18a5de38683016119b3c"},{"points":3,"mastery":4152,"_id":"562b18a5de38683016119b3b"},{"points":0,"mastery":null,"_id":"562b18a5de38683016119b3a"},{"points":0,"mastery":4154,"_id":"562b18a5de38683016119b39"}],"row4":[{"points":1,"mastery":4141,"_id":"562b18a5de38683016119b40"},{"points":0,"mastery":4142,"_id":"562b18a5de38683016119b3f"},{"points":0,"mastery":4143,"_id":"562b18a5de38683016119b3e"},{"points":1,"mastery":4144,"_id":"562b18a5de38683016119b3d"}],"row3":[{"points":1,"mastery":4131,"_id":"562b18a5de38683016119b44"},{"points":1,"mastery":4132,"_id":"562b18a5de38683016119b43"},{"points":0,"mastery":4133,"_id":"562b18a5de38683016119b42"},{"points":3,"mastery":4134,"_id":"562b18a5de38683016119b41"}],"row2":[{"points":0,"mastery":4121,"_id":"562b18a5de38683016119b48"},{"points":3,"mastery":4122,"_id":"562b18a5de38683016119b47"},{"points":0,"mastery":4123,"_id":"562b18a5de38683016119b46"},{"points":1,"mastery":4124,"_id":"562b18a5de38683016119b45"}],"row1":[{"points":1,"mastery":4111,"_id":"562b18a5de38683016119b4c"},{"points":0,"mastery":4112,"_id":"562b18a5de38683016119b4b"},{"points":4,"mastery":4113,"_id":"562b18a5de38683016119b4a"},{"points":1,"mastery":4114,"_id":"562b18a5de38683016119b49"}]}},{"tree":"Defense","total":9,"_id":"562b18a5de38683016119b20","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119b22"},{"points":0,"mastery":4262,"_id":"562b18a5de38683016119b21"}],"row5":[{"points":0,"mastery":4251,"_id":"562b18a5de38683016119b25"},{"points":0,"mastery":4252,"_id":"562b18a5de38683016119b24"},{"points":0,"mastery":4253,"_id":"562b18a5de38683016119b23"}],"row4":[{"points":0,"mastery":4241,"_id":"562b18a5de38683016119b29"},{"points":0,"mastery":4242,"_id":"562b18a5de38683016119b28"},{"points":0,"mastery":4243,"_id":"562b18a5de38683016119b27"},{"points":0,"mastery":4244,"_id":"562b18a5de38683016119b26"}],"row3":[{"points":0,"mastery":4231,"_id":"562b18a5de38683016119b2d"},{"points":1,"mastery":4232,"_id":"562b18a5de38683016119b2c"},{"points":0,"mastery":4233,"_id":"562b18a5de38683016119b2b"},{"points":0,"mastery":4234,"_id":"562b18a5de38683016119b2a"}],"row2":[{"points":1,"mastery":4221,"_id":"562b18a5de38683016119b31"},{"points":3,"mastery":4222,"_id":"562b18a5de38683016119b30"},{"points":0,"mastery":null,"_id":"562b18a5de38683016119b2f"},{"points":0,"mastery":4224,"_id":"562b18a5de38683016119b2e"}],"row1":[{"points":2,"mastery":4211,"_id":"562b18a5de38683016119b35"},{"points":2,"mastery":4212,"_id":"562b18a5de38683016119b34"},{"points":0,"mastery":4213,"_id":"562b18a5de38683016119b33"},{"points":0,"mastery":4214,"_id":"562b18a5de38683016119b32"}]}},{"tree":"Utility","total":0,"_id":"562b18a5de38683016119b0a","data":{"row6":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119b0c"},{"points":0,"mastery":4362,"_id":"562b18a5de38683016119b0b"}],"row5":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119b0f"},{"points":0,"mastery":4352,"_id":"562b18a5de38683016119b0e"},{"points":0,"mastery":4353,"_id":"562b18a5de38683016119b0d"}],"row4":[{"points":0,"mastery":4341,"_id":"562b18a5de38683016119b13"},{"points":0,"mastery":4342,"_id":"562b18a5de38683016119b12"},{"points":0,"mastery":4343,"_id":"562b18a5de38683016119b11"},{"points":0,"mastery":4344,"_id":"562b18a5de38683016119b10"}],"row3":[{"points":0,"mastery":4331,"_id":"562b18a5de38683016119b17"},{"points":0,"mastery":4332,"_id":"562b18a5de38683016119b16"},{"points":0,"mastery":4333,"_id":"562b18a5de38683016119b15"},{"points":0,"mastery":4334,"_id":"562b18a5de38683016119b14"}],"row2":[{"points":0,"mastery":null,"_id":"562b18a5de38683016119b1b"},{"points":0,"mastery":4322,"_id":"562b18a5de38683016119b1a"},{"points":0,"mastery":4323,"_id":"562b18a5de38683016119b19"},{"points":0,"mastery":4324,"_id":"562b18a5de38683016119b18"}],"row1":[{"points":0,"mastery":4311,"_id":"562b18a5de38683016119b1f"},{"points":0,"mastery":4312,"_id":"562b18a5de38683016119b1e"},{"points":0,"mastery":4313,"_id":"562b18a5de38683016119b1d"},{"points":0,"mastery":4314,"_id":"562b18a5de38683016119b1c"}]}}]}},"skills":{"highestWinPercent":{"games":11583,"winPercent":53.31,"order":["1","2","3","1","1","4","1","3","1","3","4","3","3","2","2","4","2","2"]},"mostGames":{"games":35695,"winPercent":52.69,"order":["1","3","2","1","1","4","1","3","1","3","4","3","3","2","2","4","2","2"]},"skillInfo":[{"name":"Broken Wings","img":"RivenTriCleave.png","key":"Q","_id":"562b18a5de38683016119abc"},{"name":"Ki Burst","img":"RivenMartyr.png","key":"W","_id":"562b18a5de38683016119abb"},{"name":"Valor","img":"RivenFeint.png","key":"E","_id":"562b18a5de38683016119aba"},{"name":"Blade of the Exile","img":"RivenFengShuiEngine.png","key":"R","_id":"562b18a5de38683016119ab9"}]},"summoners":{"highestWinPercent":{"games":69158,"winPercent":52.61,"summoner2":{"name":"Teleport","url":"SummonerTeleport.png"},"summoner1":{"name":"Flash","url":"SummonerFlash.png"}},"mostGames":{"games":69158,"winPercent":52.61,"summoner2":{"name":"Teleport","url":"SummonerTeleport.png"},"summoner1":{"name":"Flash","url":"SummonerFlash.png"}}},"trinkets":[{"games":73953,"winPercent":52.3,"_id":"562b18a5de38683016119ab8","item":{"id":3340,"name":"Warding Totem (Trinket)"}},{"games":303,"winPercent":51.15,"_id":"562b18a5de38683016119ab7","item":{"id":3341,"name":"Sweeping Lens (Trinket)"}},{"games":118,"winPercent":55.93,"_id":"562b18a5de38683016119ab6","item":{"id":3342,"name":"Scrying Orb (Trinket)"}}],"firstItems":{"highestWinPercent":{"games":42840,"winPercent":53.93,"items":[{"id":1055,"name":"Doran's Blade","_id":"562b18a5de38683016119ab3"},{"id":2003,"name":"Health Potion","_id":"562b18a5de38683016119ab2"}]},"mostGames":{"games":42840,"winPercent":53.93,"items":[{"id":1055,"name":"Doran's Blade","_id":"562b18a5de38683016119ab5"},{"id":2003,"name":"Health Potion","_id":"562b18a5de38683016119ab4"}]}},"items":{"highestWinPercent":{"games":7807,"winPercent":52.38,"items":[{"id":3158,"name":"Ionian Boots of Lucidity","_id":"562b18a5de38683016119aab"},{"id":3074,"name":"Ravenous Hydra (Melee Only)","_id":"562b18a5de38683016119aaa"},{"id":3035,"name":"Last Whisper","_id":"562b18a5de38683016119aa9"},{"id":3142,"name":"Youmuu's Ghostblade","_id":"562b18a5de38683016119aa8"},{"id":3072,"name":"The Bloodthirster","_id":"562b18a5de38683016119aa7"},{"id":3026,"name":"Guardian Angel","_id":"562b18a5de38683016119aa6"}]},"mostGames":{"games":7807,"winPercent":52.38,"items":[{"id":3158,"name":"Ionian Boots of Lucidity","_id":"562b18a5de38683016119ab1"},{"id":3074,"name":"Ravenous Hydra (Melee Only)","_id":"562b18a5de38683016119ab0"},{"id":3035,"name":"Last Whisper","_id":"562b18a5de38683016119aaf"},{"id":3142,"name":"Youmuu's Ghostblade","_id":"562b18a5de38683016119aae"},{"id":3072,"name":"The Bloodthirster","_id":"562b18a5de38683016119aad"},{"id":3026,"name":"Guardian Angel","_id":"562b18a5de38683016119aac"}]}},"dmgComposition":{"physicalDmg":98.9,"magicDmg":0.2,"trueDmg":0.9},"patchWin":[50.76,51.39,51.79,52.09,52.21],"experienceSample":[7.97,11.48,23.54,22.29,31.63],"experienceRate":[46.34,48.94,50.84,53.51,55.29],"gameLength":[54.24,52.23,52.27,51.48,50.88],"patchPlay":[18.54,15.64,12.75,16.48,17.53],"championMatrix":[141.41247484909454,128.15896800188574,191.92751235584836,15,78.71921182266004,93.74603573246068,84.42707495836001],"overallPosition":{"position":5,"change":1},"general":[{"title":"Win Rate","titleLink":"winPercent","val":"52.21","position":8,"change":0,"_id":"562b18a5de38683016119aa5"},{"title":"Play Rate","titleLink":"playPercent","val":"17.53","position":1,"change":0,"_id":"562b18a5de38683016119aa4"},{"title":"Ban Rate","titleLink":"banRate","val":"9.96","position":9,"change":-1,"_id":"562b18a5de38683016119aa3"},{"title":"Playerbase Average Games Played","titleLink":"experience","val":"142.05","position":9,"change":0,"_id":"562b18a5de38683016119aa2"},{"title":"Gold Earned","titleLink":"goldEarned","val":"12445","position":7,"change":-1,"_id":"562b18a5de38683016119aa1"},{"title":"Kills","titleLink":"kills","val":"7.62","position":6,"change":-1,"_id":"562b18a5de38683016119aa0"},{"title":"Deaths","titleLink":"deaths","val":"6.45","position":36,"change":1,"_id":"562b18a5de38683016119a9f"},{"title":"Assists","titleLink":"assists","val":"5.55","position":50,"change":-1,"_id":"562b18a5de38683016119a9e"},{"title":"Damage Dealt","titleLink":"totalDamageDealtToChampions","val":"20079","position":30,"change":2,"_id":"562b18a5de38683016119a9d"},{"title":"Damage Taken","titleLink":"totalDamageTaken","val":"24624","position":36,"change":1,"_id":"562b18a5de38683016119a9c"},{"title":"Minions Killed","titleLink":"minionsKilled","val":"198.68","position":11,"change":0,"_id":"562b18a5de38683016119a9b"}]};
matchupData.patchHistory = ["5.16","5.17","5.18","5.19","5.20"];
/* Has general data on the chosen champion */
</script>
我想将这些值存储在 mysql 数据库中。
这就是我所拥有的。
function curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function scrape_between($data, $start, $end){
$data = stristr($data, $start);
$data = substr($data, strlen($start));
$stop = stripos($data, $end);
$data = substr($data, 0, $stop);
return $data;
}
$scraped_page = curl("http://champion.gg/champion/Riven");
$scraped_data = scrape_between($scraped_page, '],"experienceRate":[', '],"gameLength":[');
echo $scraped_data;
它回来了
46.34,48.94,50.84,53.51,55.29
但我似乎无法找出如何隔离 48.94(第二个)和 55.29(最后一个)值。
任何帮助将不胜感激
如果字符串中的数字用“,”分隔,只需使用explode()将其除以数字,然后从结果数组中取出第二个和最后一个,瞧,完成。
解决这个问题的有趣方法是:
这并不是一个真正的 php 解决方案,但是很干净,并且较少挖掘字符串。