Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
Java_API
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deokhyun Lee
Java_API
Commits
d89eceac
Commit
d89eceac
authored
Nov 30, 2021
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added NewsSearch & BlogSearch (just need to add the other two)
parent
7772f814
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Main.java
src/Main.java
+9
-5
No files found.
src/Main.java
View file @
d89eceac
...
...
@@ -12,17 +12,21 @@ public class Main {
NaverAPI
nv
=
new
NaverAPI
();
String
keyword
=
null
;
int
counter
=
0
;
String
responseBody
=
null
;
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"1. 뉴스 검색; 2. 블로그 검색; 3. 영화 검색; 4. 책 검색"
);
counter
=
sc
.
nextLine
().
toIn
;
counter
=
Integer
.
parseInt
(
sc
.
nextLine
());
System
.
out
.
print
(
"Keyword를 말해주세요"
);
keyword
=
sc
.
nextLine
();
// String responseBody = nv.searchBlog("놀러갈만한곳");
String
responseBody
=
nv
.
searchNews
(
"코로나"
);
System
.
out
.
println
(
responseBody
);
if
(
counter
==
1
){
responseBody
=
nv
.
searchNews
(
keyword
);
}
else
if
(
counter
==
2
){
responseBody
=
nv
.
searchBlog
(
keyword
);
}
// json 파싱
Gson
gson
=
new
Gson
();
JsonObject
jsonObject
=
new
Gson
().
fromJson
(
responseBody
,
JsonObject
.
class
);
JsonArray
jsonArray
=
jsonObject
.
getAsJsonArray
(
"items"
);
for
(
JsonElement
em
:
jsonArray
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment