- 26
- 17 722
Code Edge
เข้าร่วมเมื่อ 22 ก.ย. 2022
Let's have fun with coding!
Retrieve Bitcoin value in Java
Retrieve website data in Java application with Selenium dependencies. In an example I retrieve the current Bitcoin value from coingeco.com.
00:00 - Intro
00:12 - Application presentation
00:37 - Dependencies
01:00 - Implementation
07:19 - Application launch
07:50 - Outro
00:00 - Intro
00:12 - Application presentation
00:37 - Dependencies
01:00 - Implementation
07:19 - Application launch
07:50 - Outro
มุมมอง: 105
วีดีโอ
Currency converter in Java
มุมมอง 9Kปีที่แล้ว
The Java application that converts currency with latest rate using external API. Important update: API from the video has changed, please check the new API and source code. Content of this video: 00:00 - Intro 00:13 - Project creation 01:02 - Required dependencies 01:42 - User input 03:43 - HTTP request to external API 05:28 - HTTP response extraction 07:50 - Result calculation 08:14 - Applicat...
I think they changed the key words in the API... to quotes and source... in query string
Thanks, probably yes. I will add a comment to description that API could be changed.
Awesome! Have you heard of the AI image generator Realm AI Chrome Extension? You can create different characters of yourself and others as well. It looks really good and real! I had fun using it, you should try it out. 😊
I did everything as you did But it shows: Exception in the thread "main" org.json.JSONExecption:JSONObject["rates"] not found.
It looks like jsonObject created from response doesn't contain rates object. You can check how jsonObject looks like through System.out.println(). If it looks non standard maybe returned response from external API is not proper.
@@codeedge I can't use the api ,which you used
I see that API has changed since I created this program. I think you need to get free API token to make a request. Also json response structure looks different. Please see exchangerate.host/documentation.
@@codeedge Hello, I just subscribed and I like this video. Please can you provide the correct JSON structure? (How we'll add the code or can you update the code on your github?)
I will try to find some time to upgrade the github repo. I will let you know when it's ready.
How to get Object.json file
In the line: JSONObject jsonObject = new JSONObject(stringResponse); you finally get json object. If you want to generate json file you could try this: FileWriter fileWriter = new FileWriter("D:/fileName.json"); //use your custom path fileWriter.write(jsonObject.toJSONString()); fileWriter.close();
Can I get source code pls
I added source code in the video description.
Which framework dod you use??
I just used 2 libraries: OkHttp and Json. Links in the description.
When I create the class I get an error saying that the package come is already in another module
From the description I assume that you have 2 modules in the project with the same package name. Modules identify classes inside src directory. In this case they don't know which package class is reffered to. Try to rename package.
this is by far the most legit java currency converter in terms of using api tutorial ive seen on youtube, thnx my guy mad underrated +1
yo update: im getting this error: (pls dont judge bro im new to integrating apis in java) Exception in thread "main" org.json.JSONException: JSONObject["rates"] not found. at org.json.JSONObject.get(JSONObject.java:570) at org.json.JSONObject.getJSONObject(JSONObject.java:780) at bsitCurrencyConverter.CurrencyConverter.main(CurrencyConverter.java:40)
Don't worry 😅 it looks like jsonObject created from response doesn't contain rates object. You can check how jsonObject looks like through System.out.println(). If it looks non standard maybe returned response from external API is not proper.
Are you from Poland? You sound like you are from Poland ;)
Tak jest, pozdrawiam :) It's hard to avoid Polish accent.
On which platform you wrote this code
If you are asking about which IDE I used, it was Intellij IDEA.
Put the json jsg
Hi, you can find json on full video th-cam.com/video/cRDAx0RxTMM/w-d-xo.htmlsi=2MZ67M0hlGfjMeQ4. It is shown at the time 6:49.
excellent!! Very helpful 👍
Thanks, I'm glad!
Thank you, that's what I was looking for!
Thanks so much, please do a few more!
Thanks, I will make more videos like this.
Is fmt a library or am just tripping
Yes, it's part of the standard library