wilsonfreitas / rbcb

R interface to Brazilian Central Bank web services
https://wilsonfreitas.github.io/rbcb/
Other
91 stars 22 forks source link

Is it possible to retrieve metadata as BETS package does? #38

Closed GitHunter0 closed 3 years ago

GitHunter0 commented 3 years ago

Hey @wilsonfreitas , is it possible to retrieve metadata as BETS package does via BETS::BETSsearch() ? It is an important feature and it would be great to have in rbcb.

As a side issue do you know why rbcb is so much faster than BETS? As discussed in here: https://github.com/nmecsys/BETS/issues/17

Thank you very much.

wilsonfreitas commented 3 years ago

Using the API, unfortunately no, it does not, but rbcb has a workaround. It scrapes the https://dadosabertos.bcb.gov.br/ website and return the searches results with rbcb::search_series

Try

rbcb::search_series("IPCA")
GitHunter0 commented 3 years ago

Great to know @wilsonfreitas , is it possible to adjust the encoding type? Because the results with special characters get desfigured, e.g.: "Índice nacional de preços ao consumidor - Amplo (IPCA) - Núcleo por exclusão"

GitHunter0 commented 3 years ago

Great to know @wilsonfreitas , is it possible to adjust the encoding type? Because the results with special characters get desfigured, e.g.: "�ndice nacional de preços ao consumidor - Amplo (IPCA) - Núcleo por exclusão"

@wilsonfreitas , I believe I know the solution. In your file "rbcb_search.R", replace doc <- xml2::read_html(x) with doc <- xml2::read_html(x, enconding="UTF-16")) .

Please, would you mind to implement that to see if it works?

wilsonfreitas commented 3 years ago

I've made a small change using your suggestion and I believe that now it is working.

07fb9b10aab0b54b6c0a5477c67e7e3dfb4005d7

Tks.