Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Crawling Java
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
Crawling Java
Commits
7d95a5eb
Commit
7d95a5eb
authored
Dec 04, 2021
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
여러가지 해보는중
parents
Pipeline
#2109
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
.gitignore
.gitignore
+11
-0
Main.java
src/Main.java
+35
-0
No files found.
.gitignore
0 → 100644
View file @
7d95a5eb
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/.idea/
/out/
/Crawling.iml
src/Main.java
0 → 100644
View file @
7d95a5eb
package
melon
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.Scanner
;
import
org.jsoup.Jsoup
;
import
org.jsoup.nodes.Document
;
import
org.jsoup.nodes.Element
;
import
org.jsoup.select.Elements
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// 멜로 100 차트
System
.
out
.
println
(
"멜론 100 출력"
);
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"검색어: "
);
String
str
=
sc
.
next
();
String
text
=
URLEncoder
.
encode
(
str
,
"UTF-8"
);
String
URL
=
"https://search.naver.com/search.naver?query="
+
text
+
"&where=news&ie=utf8&sm=nws_hty"
;
Document
doc
=
Jsoup
.
connect
(
URL
).
get
();
Elements
elem
=
doc
.
select
(
"div[class=\"group_news\"]"
);
for
(
Element
e
:
elem
.
select
(
"a"
))
{
if
(
e
.
className
().
equals
(
"news_tit"
))
{
System
.
out
.
println
(
e
.
text
());
// continue;
}
}
}
}
\ No newline at end of file
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