Powershell parse Html series to save it in a csv












2















I'm trying to scrape a website to keep track of my ranking in a Rocket League playlist over time automatically. The idea being that I'd grab the number corresponding to my playlist and put it in a csv for tacking purposes. I've been able to get the Html for the webpage but can't seem to parse it effectively for the number I'm after.



Here's how I've gathered the webpage info:



$tracker = Invoke-WebRequest -Uri 
https://rocketleague.tracker.network/profile/steam/adammast12

$tracker.RawContent


Here's the section of the RawContent that is of interest to me:



<script type="text/javascript">
$('#playlist-tracking-rating').highcharts({
chart: {
type: 'line',
zoomType: 'xy'
},
title: {
text: 'Rating Progression'
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
},
yAxis: {
title: {
text: 'Rating'
}
},
tooltip: {
enabled: true,
shared: true
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
series: [

{ name: 'Un-Ranked', data: [1270,1270,1270,1270,1270,1251] },


{ name: 'Ranked Duel 1v1', data: [655,655,655,655,655,655] },


{ name: 'Ranked Doubles 2v2', data: [815,775,856,847,865,865] },


{ name: 'Ranked Solo Standard 3v3', data: [788,788,788,788,788,788] },


{ name: 'Ranked Standard 3v3', data: [994,994,994,994,994,994] },


{ name: 'Hoops', data: [556,556,556,556,525,525] },


{ name: 'Rumble', data: [651,741,703,703,704,704] },


{ name: 'Dropshot', data: [635,635,635,635,635,635] },


{ name: 'Snowday', data: [770,770] },

]
});

$('#playlist-tracking').highcharts({
chart: {
type: 'spline',
zoomType: 'xy'
},
title: {
text: 'Tier Over Time'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
labels: {
overflow: 'justify'
}
},
tooltip: {
enabled: true,
shared: true
},
yAxis: {
title: {
text: ''
},
labels: {
enabled: false
},
minorGridLineWidth: 0,
gridLineWidth: 0,
alternateGridColor: null,
plotBands: [{
from: 0,
to: 0.99,
color: 'rgba(75, 75, 75, 0.1)',
label: {
text: 'Unranked',
style: {
color: '#606060'
}
}
}, {
from: 1,
to: 1.99,
color: 'rgba(227, 150, 68, 0.1',
label: {
text: 'Bronze I',
style: {
color: '#606060'
}
}
}, {
from: 2,
to: 2.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze II',
style: {
color: '#606060'
}
}
}, {
from: 3,
to: 3.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze III',
style: {
color: '#606060'
}
}
}, {
from: 4,
to: 4.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver I',
style: {
color: '#606060'
}
}
}, {
from: 5,
to: 5.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver II',
style: {
color: '#606060'
}
}
}, {
from: 6,
to: 6.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver III',
style: {
color: '#606060'
}
}
}, {
from: 7,
to: 7.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold I',
style: {
color: '#606060'
}
}
}, {
from: 8,
to: 8.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold II',
style: {
color: '#606060'
}
}
}, {
from: 9,
to: 9.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold III',
style: {
color: '#606060'
}
}
}, {
from: 10,
to: 10.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum I',
style: {
color: '#606060'
}
}
}, {
from: 11,
to: 11.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum II',
style: {
color: '#606060'
}
}
}, {
from: 12,
to: 12.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum III',
style: {
color: '#606060'
}
}
}, {
from: 13,
to: 13.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond I',
style: {
color: '#606060'
}
}
}, {
from: 14,
to: 14.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion I',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(249, 135, 254, 0.1)',
label: {
text: 'Grand Champion',
style: {
color: '#606060'
}
}
}]
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false
}
}
},
navigation: {
menuItemStyle: {
fontSize: '10px'
}
},
series: [

{ name: 'Ranked Duel 1v1', data: [0,0,0,0,0,0] },


{ name: 'Ranked Doubles 2v2', data: [11,11,12,12,12,12] },


{ name: 'Ranked Solo Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Hoops', data: [0,0,0,0,0,0] },


{ name: 'Rumble', data: [0,11,11,11,11,11] },


{ name: 'Dropshot', data: [10,10,10,10,10,10] },


{ name: 'Snowday', data: [12,12] },


]
});




I'd like to get the information out of the series related to the ranked playlists. For example, I need to be able to get the first value corresponding to "Ranked Duel 1v1" and "Ranked Doubles 2v2" etc. so I can save that number in a csv.



I've tried searching by string like this:



$data = $tracker.tostring() -split "[`r`n]" | select-string "Ranked Standard 3v3"


Which gives me this as a result:



  Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
{ name: 'Ranked Standard 3v3', data:
[994,994,994,994,994,994] },
{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


I'm not sure how to parse it from there though. Thanks for any help!










share|improve this question























  • How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

    – trebleCode
    Nov 13 '18 at 15:32











  • For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

    – Adam Powell
    Nov 13 '18 at 15:39











  • $tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

    – Deadly-Bagel
    Nov 13 '18 at 15:54
















2















I'm trying to scrape a website to keep track of my ranking in a Rocket League playlist over time automatically. The idea being that I'd grab the number corresponding to my playlist and put it in a csv for tacking purposes. I've been able to get the Html for the webpage but can't seem to parse it effectively for the number I'm after.



Here's how I've gathered the webpage info:



$tracker = Invoke-WebRequest -Uri 
https://rocketleague.tracker.network/profile/steam/adammast12

$tracker.RawContent


Here's the section of the RawContent that is of interest to me:



<script type="text/javascript">
$('#playlist-tracking-rating').highcharts({
chart: {
type: 'line',
zoomType: 'xy'
},
title: {
text: 'Rating Progression'
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
},
yAxis: {
title: {
text: 'Rating'
}
},
tooltip: {
enabled: true,
shared: true
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
series: [

{ name: 'Un-Ranked', data: [1270,1270,1270,1270,1270,1251] },


{ name: 'Ranked Duel 1v1', data: [655,655,655,655,655,655] },


{ name: 'Ranked Doubles 2v2', data: [815,775,856,847,865,865] },


{ name: 'Ranked Solo Standard 3v3', data: [788,788,788,788,788,788] },


{ name: 'Ranked Standard 3v3', data: [994,994,994,994,994,994] },


{ name: 'Hoops', data: [556,556,556,556,525,525] },


{ name: 'Rumble', data: [651,741,703,703,704,704] },


{ name: 'Dropshot', data: [635,635,635,635,635,635] },


{ name: 'Snowday', data: [770,770] },

]
});

$('#playlist-tracking').highcharts({
chart: {
type: 'spline',
zoomType: 'xy'
},
title: {
text: 'Tier Over Time'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
labels: {
overflow: 'justify'
}
},
tooltip: {
enabled: true,
shared: true
},
yAxis: {
title: {
text: ''
},
labels: {
enabled: false
},
minorGridLineWidth: 0,
gridLineWidth: 0,
alternateGridColor: null,
plotBands: [{
from: 0,
to: 0.99,
color: 'rgba(75, 75, 75, 0.1)',
label: {
text: 'Unranked',
style: {
color: '#606060'
}
}
}, {
from: 1,
to: 1.99,
color: 'rgba(227, 150, 68, 0.1',
label: {
text: 'Bronze I',
style: {
color: '#606060'
}
}
}, {
from: 2,
to: 2.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze II',
style: {
color: '#606060'
}
}
}, {
from: 3,
to: 3.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze III',
style: {
color: '#606060'
}
}
}, {
from: 4,
to: 4.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver I',
style: {
color: '#606060'
}
}
}, {
from: 5,
to: 5.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver II',
style: {
color: '#606060'
}
}
}, {
from: 6,
to: 6.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver III',
style: {
color: '#606060'
}
}
}, {
from: 7,
to: 7.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold I',
style: {
color: '#606060'
}
}
}, {
from: 8,
to: 8.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold II',
style: {
color: '#606060'
}
}
}, {
from: 9,
to: 9.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold III',
style: {
color: '#606060'
}
}
}, {
from: 10,
to: 10.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum I',
style: {
color: '#606060'
}
}
}, {
from: 11,
to: 11.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum II',
style: {
color: '#606060'
}
}
}, {
from: 12,
to: 12.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum III',
style: {
color: '#606060'
}
}
}, {
from: 13,
to: 13.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond I',
style: {
color: '#606060'
}
}
}, {
from: 14,
to: 14.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion I',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(249, 135, 254, 0.1)',
label: {
text: 'Grand Champion',
style: {
color: '#606060'
}
}
}]
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false
}
}
},
navigation: {
menuItemStyle: {
fontSize: '10px'
}
},
series: [

{ name: 'Ranked Duel 1v1', data: [0,0,0,0,0,0] },


{ name: 'Ranked Doubles 2v2', data: [11,11,12,12,12,12] },


{ name: 'Ranked Solo Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Hoops', data: [0,0,0,0,0,0] },


{ name: 'Rumble', data: [0,11,11,11,11,11] },


{ name: 'Dropshot', data: [10,10,10,10,10,10] },


{ name: 'Snowday', data: [12,12] },


]
});




I'd like to get the information out of the series related to the ranked playlists. For example, I need to be able to get the first value corresponding to "Ranked Duel 1v1" and "Ranked Doubles 2v2" etc. so I can save that number in a csv.



I've tried searching by string like this:



$data = $tracker.tostring() -split "[`r`n]" | select-string "Ranked Standard 3v3"


Which gives me this as a result:



  Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
{ name: 'Ranked Standard 3v3', data:
[994,994,994,994,994,994] },
{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


I'm not sure how to parse it from there though. Thanks for any help!










share|improve this question























  • How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

    – trebleCode
    Nov 13 '18 at 15:32











  • For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

    – Adam Powell
    Nov 13 '18 at 15:39











  • $tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

    – Deadly-Bagel
    Nov 13 '18 at 15:54














2












2








2








I'm trying to scrape a website to keep track of my ranking in a Rocket League playlist over time automatically. The idea being that I'd grab the number corresponding to my playlist and put it in a csv for tacking purposes. I've been able to get the Html for the webpage but can't seem to parse it effectively for the number I'm after.



Here's how I've gathered the webpage info:



$tracker = Invoke-WebRequest -Uri 
https://rocketleague.tracker.network/profile/steam/adammast12

$tracker.RawContent


Here's the section of the RawContent that is of interest to me:



<script type="text/javascript">
$('#playlist-tracking-rating').highcharts({
chart: {
type: 'line',
zoomType: 'xy'
},
title: {
text: 'Rating Progression'
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
},
yAxis: {
title: {
text: 'Rating'
}
},
tooltip: {
enabled: true,
shared: true
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
series: [

{ name: 'Un-Ranked', data: [1270,1270,1270,1270,1270,1251] },


{ name: 'Ranked Duel 1v1', data: [655,655,655,655,655,655] },


{ name: 'Ranked Doubles 2v2', data: [815,775,856,847,865,865] },


{ name: 'Ranked Solo Standard 3v3', data: [788,788,788,788,788,788] },


{ name: 'Ranked Standard 3v3', data: [994,994,994,994,994,994] },


{ name: 'Hoops', data: [556,556,556,556,525,525] },


{ name: 'Rumble', data: [651,741,703,703,704,704] },


{ name: 'Dropshot', data: [635,635,635,635,635,635] },


{ name: 'Snowday', data: [770,770] },

]
});

$('#playlist-tracking').highcharts({
chart: {
type: 'spline',
zoomType: 'xy'
},
title: {
text: 'Tier Over Time'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
labels: {
overflow: 'justify'
}
},
tooltip: {
enabled: true,
shared: true
},
yAxis: {
title: {
text: ''
},
labels: {
enabled: false
},
minorGridLineWidth: 0,
gridLineWidth: 0,
alternateGridColor: null,
plotBands: [{
from: 0,
to: 0.99,
color: 'rgba(75, 75, 75, 0.1)',
label: {
text: 'Unranked',
style: {
color: '#606060'
}
}
}, {
from: 1,
to: 1.99,
color: 'rgba(227, 150, 68, 0.1',
label: {
text: 'Bronze I',
style: {
color: '#606060'
}
}
}, {
from: 2,
to: 2.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze II',
style: {
color: '#606060'
}
}
}, {
from: 3,
to: 3.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze III',
style: {
color: '#606060'
}
}
}, {
from: 4,
to: 4.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver I',
style: {
color: '#606060'
}
}
}, {
from: 5,
to: 5.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver II',
style: {
color: '#606060'
}
}
}, {
from: 6,
to: 6.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver III',
style: {
color: '#606060'
}
}
}, {
from: 7,
to: 7.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold I',
style: {
color: '#606060'
}
}
}, {
from: 8,
to: 8.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold II',
style: {
color: '#606060'
}
}
}, {
from: 9,
to: 9.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold III',
style: {
color: '#606060'
}
}
}, {
from: 10,
to: 10.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum I',
style: {
color: '#606060'
}
}
}, {
from: 11,
to: 11.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum II',
style: {
color: '#606060'
}
}
}, {
from: 12,
to: 12.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum III',
style: {
color: '#606060'
}
}
}, {
from: 13,
to: 13.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond I',
style: {
color: '#606060'
}
}
}, {
from: 14,
to: 14.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion I',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(249, 135, 254, 0.1)',
label: {
text: 'Grand Champion',
style: {
color: '#606060'
}
}
}]
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false
}
}
},
navigation: {
menuItemStyle: {
fontSize: '10px'
}
},
series: [

{ name: 'Ranked Duel 1v1', data: [0,0,0,0,0,0] },


{ name: 'Ranked Doubles 2v2', data: [11,11,12,12,12,12] },


{ name: 'Ranked Solo Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Hoops', data: [0,0,0,0,0,0] },


{ name: 'Rumble', data: [0,11,11,11,11,11] },


{ name: 'Dropshot', data: [10,10,10,10,10,10] },


{ name: 'Snowday', data: [12,12] },


]
});




I'd like to get the information out of the series related to the ranked playlists. For example, I need to be able to get the first value corresponding to "Ranked Duel 1v1" and "Ranked Doubles 2v2" etc. so I can save that number in a csv.



I've tried searching by string like this:



$data = $tracker.tostring() -split "[`r`n]" | select-string "Ranked Standard 3v3"


Which gives me this as a result:



  Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
{ name: 'Ranked Standard 3v3', data:
[994,994,994,994,994,994] },
{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


I'm not sure how to parse it from there though. Thanks for any help!










share|improve this question














I'm trying to scrape a website to keep track of my ranking in a Rocket League playlist over time automatically. The idea being that I'd grab the number corresponding to my playlist and put it in a csv for tacking purposes. I've been able to get the Html for the webpage but can't seem to parse it effectively for the number I'm after.



Here's how I've gathered the webpage info:



$tracker = Invoke-WebRequest -Uri 
https://rocketleague.tracker.network/profile/steam/adammast12

$tracker.RawContent


Here's the section of the RawContent that is of interest to me:



<script type="text/javascript">
$('#playlist-tracking-rating').highcharts({
chart: {
type: 'line',
zoomType: 'xy'
},
title: {
text: 'Rating Progression'
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
},
yAxis: {
title: {
text: 'Rating'
}
},
tooltip: {
enabled: true,
shared: true
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
series: [

{ name: 'Un-Ranked', data: [1270,1270,1270,1270,1270,1251] },


{ name: 'Ranked Duel 1v1', data: [655,655,655,655,655,655] },


{ name: 'Ranked Doubles 2v2', data: [815,775,856,847,865,865] },


{ name: 'Ranked Solo Standard 3v3', data: [788,788,788,788,788,788] },


{ name: 'Ranked Standard 3v3', data: [994,994,994,994,994,994] },


{ name: 'Hoops', data: [556,556,556,556,525,525] },


{ name: 'Rumble', data: [651,741,703,703,704,704] },


{ name: 'Dropshot', data: [635,635,635,635,635,635] },


{ name: 'Snowday', data: [770,770] },

]
});

$('#playlist-tracking').highcharts({
chart: {
type: 'spline',
zoomType: 'xy'
},
title: {
text: 'Tier Over Time'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Nov 05','Nov 08','Nov 10','Nov 11','Nov 12','Nov 13'],
type: 'date',
labels: {
overflow: 'justify'
}
},
tooltip: {
enabled: true,
shared: true
},
yAxis: {
title: {
text: ''
},
labels: {
enabled: false
},
minorGridLineWidth: 0,
gridLineWidth: 0,
alternateGridColor: null,
plotBands: [{
from: 0,
to: 0.99,
color: 'rgba(75, 75, 75, 0.1)',
label: {
text: 'Unranked',
style: {
color: '#606060'
}
}
}, {
from: 1,
to: 1.99,
color: 'rgba(227, 150, 68, 0.1',
label: {
text: 'Bronze I',
style: {
color: '#606060'
}
}
}, {
from: 2,
to: 2.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze II',
style: {
color: '#606060'
}
}
}, {
from: 3,
to: 3.99,
color: 'rgba(227, 150, 68, 0.1)',
label: {
text: 'Bronze III',
style: {
color: '#606060'
}
}
}, {
from: 4,
to: 4.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver I',
style: {
color: '#606060'
}
}
}, {
from: 5,
to: 5.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver II',
style: {
color: '#606060'
}
}
}, {
from: 6,
to: 6.99,
color: 'rgba(197, 197, 197, 0.1)',
label: {
text: 'Silver III',
style: {
color: '#606060'
}
}
}, {
from: 7,
to: 7.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold I',
style: {
color: '#606060'
}
}
}, {
from: 8,
to: 8.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold II',
style: {
color: '#606060'
}
}
}, {
from: 9,
to: 9.99,
color: 'rgba(206, 163, 32, 0.1)',
label: {
text: 'Gold III',
style: {
color: '#606060'
}
}
}, {
from: 10,
to: 10.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum I',
style: {
color: '#606060'
}
}
}, {
from: 11,
to: 11.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum II',
style: {
color: '#606060'
}
}
}, {
from: 12,
to: 12.99,
color: 'rgba(37, 161, 213, 0.1)',
label: {
text: 'Platinum III',
style: {
color: '#606060'
}
}
}, {
from: 13,
to: 13.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond I',
style: {
color: '#606060'
}
}
}, {
from: 14,
to: 14.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(0, 79, 182, 0.1)',
label: {
text: 'Diamond III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion I',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion II',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(142, 89, 225, 0.1)',
label: {
text: 'Champion III',
style: {
color: '#606060'
}
}
}, {
from: 15,
to: 15.99,
color: 'rgba(249, 135, 254, 0.1)',
label: {
text: 'Grand Champion',
style: {
color: '#606060'
}
}
}]
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false
}
}
},
navigation: {
menuItemStyle: {
fontSize: '10px'
}
},
series: [

{ name: 'Ranked Duel 1v1', data: [0,0,0,0,0,0] },


{ name: 'Ranked Doubles 2v2', data: [11,11,12,12,12,12] },


{ name: 'Ranked Solo Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


{ name: 'Hoops', data: [0,0,0,0,0,0] },


{ name: 'Rumble', data: [0,11,11,11,11,11] },


{ name: 'Dropshot', data: [10,10,10,10,10,10] },


{ name: 'Snowday', data: [12,12] },


]
});




I'd like to get the information out of the series related to the ranked playlists. For example, I need to be able to get the first value corresponding to "Ranked Duel 1v1" and "Ranked Doubles 2v2" etc. so I can save that number in a csv.



I've tried searching by string like this:



$data = $tracker.tostring() -split "[`r`n]" | select-string "Ranked Standard 3v3"


Which gives me this as a result:



  Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
Ranked Standard 3v3
{ name: 'Ranked Standard 3v3', data:
[994,994,994,994,994,994] },
{ name: 'Ranked Standard 3v3', data: [0,0,0,0,0,0] },


I'm not sure how to parse it from there though. Thanks for any help!







html powershell parsing html-parsing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 15:20









Adam PowellAdam Powell

163




163













  • How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

    – trebleCode
    Nov 13 '18 at 15:32











  • For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

    – Adam Powell
    Nov 13 '18 at 15:39











  • $tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

    – Deadly-Bagel
    Nov 13 '18 at 15:54



















  • How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

    – trebleCode
    Nov 13 '18 at 15:32











  • For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

    – Adam Powell
    Nov 13 '18 at 15:39











  • $tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

    – Deadly-Bagel
    Nov 13 '18 at 15:54

















How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

– trebleCode
Nov 13 '18 at 15:32





How do you want your CSV headers? Thinking you can just use a PSCustomObject and append that to your file. Let me know and I'll try to help

– trebleCode
Nov 13 '18 at 15:32













For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

– Adam Powell
Nov 13 '18 at 15:39





For now I'd want the headers to be "1's MMR", "2's MMR", "Solo 3's MMR" and then "3's MMR". I haven't looked far enough ahead as far as trying to actually move the data to a csv so if you already know a quick way to do that that would be helpful as well!

– Adam Powell
Nov 13 '18 at 15:39













$tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

– Deadly-Bagel
Nov 13 '18 at 15:54





$tracker.parsedhtml.scripts | Where Text -like '*$(''#playlist-tracking-rating'').highcharts*' to get the requested script... but not sure about extracting the data from there in a "clean" way...

– Deadly-Bagel
Nov 13 '18 at 15:54












1 Answer
1






active

oldest

votes


















0














Here's a sample of how to just get the 'Un-tracked' section:



# result ArrayList
$results = New-Object System.Collections.ArrayList

# REST Get

$tracker = Invoke-WebRequest -Uri https://rocketleague.tracker.network/profile/steam/adammast12

# HTML data
# $tracker.RawContent

# split by carriage return + new line
# select the JSON with "name:" in it
$data = $tracker.tostring() -split "`r`n" | Select-String "name:"

# Un-Ranked data
$unranked = $data | Select-String "name: 'Un-Ranked'"

# Split at 's

$unrankedSplit = $unranked.ToString().Split('[').Split(']')

# this yields a result like this:
# { name: 'Un-Ranked', data:
# 1270,1270,1270,1270,1270,1251
# },
#
# Split again at the second position on each comma, position [1]
# since PowerShell is zero-based indexing


$unrankedSplitChild = $unrankedSplit[1].Split(',')

# loop through each item with custom objects
foreach($item in $unrankedSplitChild)
{
# create a PSCustomObject and add to to the results
$results += [PSCustomObject]@{Category="Un-Ranked";Data=$item}
}

# throw the results to the console
$results | Format-Table -AutoSize





share|improve this answer
























  • Thank you so much, this is exactly what I needed!

    – Adam Powell
    Nov 13 '18 at 17:08











  • No prob, glad I could help

    – trebleCode
    Nov 13 '18 at 17:44











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284145%2fpowershell-parse-html-series-to-save-it-in-a-csv%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Here's a sample of how to just get the 'Un-tracked' section:



# result ArrayList
$results = New-Object System.Collections.ArrayList

# REST Get

$tracker = Invoke-WebRequest -Uri https://rocketleague.tracker.network/profile/steam/adammast12

# HTML data
# $tracker.RawContent

# split by carriage return + new line
# select the JSON with "name:" in it
$data = $tracker.tostring() -split "`r`n" | Select-String "name:"

# Un-Ranked data
$unranked = $data | Select-String "name: 'Un-Ranked'"

# Split at 's

$unrankedSplit = $unranked.ToString().Split('[').Split(']')

# this yields a result like this:
# { name: 'Un-Ranked', data:
# 1270,1270,1270,1270,1270,1251
# },
#
# Split again at the second position on each comma, position [1]
# since PowerShell is zero-based indexing


$unrankedSplitChild = $unrankedSplit[1].Split(',')

# loop through each item with custom objects
foreach($item in $unrankedSplitChild)
{
# create a PSCustomObject and add to to the results
$results += [PSCustomObject]@{Category="Un-Ranked";Data=$item}
}

# throw the results to the console
$results | Format-Table -AutoSize





share|improve this answer
























  • Thank you so much, this is exactly what I needed!

    – Adam Powell
    Nov 13 '18 at 17:08











  • No prob, glad I could help

    – trebleCode
    Nov 13 '18 at 17:44
















0














Here's a sample of how to just get the 'Un-tracked' section:



# result ArrayList
$results = New-Object System.Collections.ArrayList

# REST Get

$tracker = Invoke-WebRequest -Uri https://rocketleague.tracker.network/profile/steam/adammast12

# HTML data
# $tracker.RawContent

# split by carriage return + new line
# select the JSON with "name:" in it
$data = $tracker.tostring() -split "`r`n" | Select-String "name:"

# Un-Ranked data
$unranked = $data | Select-String "name: 'Un-Ranked'"

# Split at 's

$unrankedSplit = $unranked.ToString().Split('[').Split(']')

# this yields a result like this:
# { name: 'Un-Ranked', data:
# 1270,1270,1270,1270,1270,1251
# },
#
# Split again at the second position on each comma, position [1]
# since PowerShell is zero-based indexing


$unrankedSplitChild = $unrankedSplit[1].Split(',')

# loop through each item with custom objects
foreach($item in $unrankedSplitChild)
{
# create a PSCustomObject and add to to the results
$results += [PSCustomObject]@{Category="Un-Ranked";Data=$item}
}

# throw the results to the console
$results | Format-Table -AutoSize





share|improve this answer
























  • Thank you so much, this is exactly what I needed!

    – Adam Powell
    Nov 13 '18 at 17:08











  • No prob, glad I could help

    – trebleCode
    Nov 13 '18 at 17:44














0












0








0







Here's a sample of how to just get the 'Un-tracked' section:



# result ArrayList
$results = New-Object System.Collections.ArrayList

# REST Get

$tracker = Invoke-WebRequest -Uri https://rocketleague.tracker.network/profile/steam/adammast12

# HTML data
# $tracker.RawContent

# split by carriage return + new line
# select the JSON with "name:" in it
$data = $tracker.tostring() -split "`r`n" | Select-String "name:"

# Un-Ranked data
$unranked = $data | Select-String "name: 'Un-Ranked'"

# Split at 's

$unrankedSplit = $unranked.ToString().Split('[').Split(']')

# this yields a result like this:
# { name: 'Un-Ranked', data:
# 1270,1270,1270,1270,1270,1251
# },
#
# Split again at the second position on each comma, position [1]
# since PowerShell is zero-based indexing


$unrankedSplitChild = $unrankedSplit[1].Split(',')

# loop through each item with custom objects
foreach($item in $unrankedSplitChild)
{
# create a PSCustomObject and add to to the results
$results += [PSCustomObject]@{Category="Un-Ranked";Data=$item}
}

# throw the results to the console
$results | Format-Table -AutoSize





share|improve this answer













Here's a sample of how to just get the 'Un-tracked' section:



# result ArrayList
$results = New-Object System.Collections.ArrayList

# REST Get

$tracker = Invoke-WebRequest -Uri https://rocketleague.tracker.network/profile/steam/adammast12

# HTML data
# $tracker.RawContent

# split by carriage return + new line
# select the JSON with "name:" in it
$data = $tracker.tostring() -split "`r`n" | Select-String "name:"

# Un-Ranked data
$unranked = $data | Select-String "name: 'Un-Ranked'"

# Split at 's

$unrankedSplit = $unranked.ToString().Split('[').Split(']')

# this yields a result like this:
# { name: 'Un-Ranked', data:
# 1270,1270,1270,1270,1270,1251
# },
#
# Split again at the second position on each comma, position [1]
# since PowerShell is zero-based indexing


$unrankedSplitChild = $unrankedSplit[1].Split(',')

# loop through each item with custom objects
foreach($item in $unrankedSplitChild)
{
# create a PSCustomObject and add to to the results
$results += [PSCustomObject]@{Category="Un-Ranked";Data=$item}
}

# throw the results to the console
$results | Format-Table -AutoSize






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 16:13









trebleCodetrebleCode

689515




689515













  • Thank you so much, this is exactly what I needed!

    – Adam Powell
    Nov 13 '18 at 17:08











  • No prob, glad I could help

    – trebleCode
    Nov 13 '18 at 17:44



















  • Thank you so much, this is exactly what I needed!

    – Adam Powell
    Nov 13 '18 at 17:08











  • No prob, glad I could help

    – trebleCode
    Nov 13 '18 at 17:44

















Thank you so much, this is exactly what I needed!

– Adam Powell
Nov 13 '18 at 17:08





Thank you so much, this is exactly what I needed!

– Adam Powell
Nov 13 '18 at 17:08













No prob, glad I could help

– trebleCode
Nov 13 '18 at 17:44





No prob, glad I could help

– trebleCode
Nov 13 '18 at 17:44


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284145%2fpowershell-parse-html-series-to-save-it-in-a-csv%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine