How to slice up javascript array data from a widget and place into xml or json format?

Greetings, members of the Coding Technorati. I bring my dilemma to you in search of an answer. Does anyone know how to render javascript feed data into a string and parse to xml?
here is the javascript feed:

<div class="pouch"ng-show="coin0">
        <div class="pouchA">
        <script type="text/javascript" src="https://files.coinmarketcap.com/static/widget/currency.js"></script>
        <div class="coinmarketcap-currency-widget" data-currencyid="1" data-base="USDT" data-secondary="BTC" data-ticker="true" data-rank="true" data-marketcap="true" data-volume="true" data-stats="USD" data-statsticker="true"></div>
</div>

Is it possible to grab data and place it into a variable and then use a slice() function to further separate the array data? Please enlighten me as to the error of my ways.

Thanks in advance,
Batoe

Ok, firstly the data comprises of an image, coin description, price, Market capitalization value etc. You can view the rendered feed by placing the div in an html document. I need to convert the data into variables which will then be placed into a json or xml document. but I need separate variable array data into individual variables. Thanks again for your time.

Batoe

I’m not going to drop an arbitrary bit of code from a stranger into a file and execute it, but maybe someone else will do that for you.

Your contextless html snippet links to a javascript file (which you can prettify/unminify to get some idea of what it’s up to). That javascript file appears to contain an api call (to https://widgets.coinmarketcap.com/v2/ticker/. A quick glance at coinmarketcap reveals that they have a public api.

My suggestion would be to get your own api keys, read their api documentation, and make the api calls necessary to get the data you want. Then process it however you see fit for whatever purpose you have.

If you’re running this widget in your browser, the Network tab in chrome should have the api calls it’s making, and their (probably JSON) response. Interpreting that yourself (or posting the shape of the data and specific details about what shape you need it in) would enable us to help you more.

1 Like