Vi faccio un esempio pratico di utilizzo della AI.
L'anno scorso mi serviva prelevare i dati da un grafico interattivo sul sito di morningstar. Per capire come fare sono stato a perdere un sacco di tempo su google pendando di usare Selenium o roba simile poi alla fine ho trovato il modo più rapido e facile usando DevTool e ispezionando le varie schede fino a trovare quello che mi serviva per poi ripulire i dati.
Ora se chiedo a bing: "I need web scraping an interactive web chart on this page: https://www.morningstar.com/market-fair-value" lui in un decimo di secondo mi scrive quello che invece mi ha portato via un sacco di tempo migliorando anche la procedura:
"To web scrape an interactive web chart on this page, you can follow these steps:
- Open the developer tools of your browser by right-clicking on the page and selecting “Inspect”.
- Go to the “Network” tab and reload the page. You will see a list of requests that the page makes to load its content.
- Filter the requests by type “XHR” or “Fetch”, which are used to fetch data from a server. You can also use the search box to look for keywords related to the chart, such as “fair value” or “ratio”.
- Find the request that contains the data for the chart. You can check the “Preview” or “Response” tabs to see the data in a JSON format.
- Copy the URL of the request and use a tool like search_web to get the JSON data as a string.
- Parse the JSON data using a library like json in Python or JSON.parse in JavaScript. You can access the data for the chart by using keys like “data”, “series”, and “values”.
- Extract the data you need from the JSON object and store it in a variable or a data structure of your choice. You can also manipulate or transform the data as needed.
- Save or export the data to a file or a database, or use it for further analysis or visualization."
https://themarketjourney.substack.com :
economia, modelli, mercato, finanza
Segnalibri