Yahoo Finance Scraper

Witold Baryluk witold.baryluk at gmail.com
Sun Dec 17 17:49:31 UTC 2023


On Thursday, 14 December 2023 at 00:31:34 UTC, Selim Ozel wrote:
> https://forum.dlang.org/post/temmuvdikcuffkymihun@forum.dlang.org
>
> Hello again. This scraper worked for me since 2020 but 
> apparently Yahoo decided to change some of the API and it 
> stopped working a while back. Last week I worked on updating it 
> and it seems to work again. I haven't done a great job at 
> testing the code so be careful with it but it seems to work for 
> me. I can probably add a few more things if anyone's interested 
> in it.
>
> https://github.com/SelimOzel/YahooFinanceD
>
> Best,
> Selim

```
user at debian:~$ dub run yahoofinanced:example-csv
      Warning Package 'yahoofinanced:example-csv' was neither 
found locally nor online.
user at debian:~$ dub run yahoofinanced:example-dataframe
      Warning Package 'yahoofinanced:example-dataframe' was 
neither found locally nor online.
user at debian:~$
```

I think README fails to mention that you need to clone the repo, 
and do it from the repo directory.


On a good noite, it looks like it works with gdc compiler out of 
the box. Nice.

Minor issues:

```
user at debian:~/YahooFinanceD$ dub run yahoofinanced:example-csv
              Building package yahoofinanced:example-csv in 
/home/user/YahooFinanceD/
     Starting Performing "debug" build using /usr/bin/gdc for 
x86_64.
     Building yahoofinanced:example-csv 1.1.1: building 
configuration [application]
      Running example-csv
Retrieveing MSFT between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/MSFT?period1=1544598000&period2=1591772400&interval=1d&events=divs&includeAdjustedClose=true
Retrieveing AAPL between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1544598000&period2=1591772400&interval=1d&events=divs&includeAdjustedClose=true
Retrieveing AMZN between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/AMZN?period1=1544598000&period2=1591772400&interval=1d&events=divs&includeAdjustedClose=true
Retrieveing GM between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/GM?period1=1544598000&period2=1591772400&interval=1d&events=divs&includeAdjustedClose=true
Retrieveing F between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/F?period1=1544598000&period2=1591772400&interval=1d&events=divs&includeAdjustedClose=true
Retrieveing FCAU between 1544598000 and 1591772400.
Using query: 
https://query1.finance.yahoo.com/v7/finance/download/FCAU?period1=1544598000&period2=1591772400&interval=1d&events=history&includeAdjustedClose=true
HTTP request returned status code 404 ()
user at debian:~/YahooFinanceD$
```

Maybe ignore 404 errors, and continue with the code. My guess the 
`FCAU` is no longer listed.



More information about the Digitalmars-d-announce mailing list