Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
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
沈俊林
webmagic
Commits
4cc3b606
Commit
4cc3b606
authored
Apr 23, 2018
by
shenjunlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回可用的代理
parent
7b45bc9a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
8 deletions
+13
-8
pom.xml
pom.xml
+1
-1
pom.xml
webmagic-core/pom.xml
+1
-1
SimpleProxyProvider.java
...java/us/codecraft/webmagic/proxy/SimpleProxyProvider.java
+6
-1
ProxyUtils.java
...src/main/java/us/codecraft/webmagic/utils/ProxyUtils.java
+1
-1
pom.xml
webmagic-extension/pom.xml
+1
-1
pom.xml
webmagic-samples/pom.xml
+1
-1
pom.xml
webmagic-saxon/pom.xml
+1
-1
pom.xml
webmagic-scripts/pom.xml
+1
-1
No files found.
pom.xml
View file @
4cc3b606
...
...
@@ -6,7 +6,7 @@
<version>
7
</version>
</parent>
<groupId>
us.codecraft.duiba
</groupId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
pom
</packaging>
<properties>
...
...
webmagic-core/pom.xml
View file @
4cc3b606
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/proxy/SimpleProxyProvider.java
View file @
4cc3b606
...
...
@@ -2,6 +2,7 @@ package us.codecraft.webmagic.proxy;
import
us.codecraft.webmagic.Page
;
import
us.codecraft.webmagic.Task
;
import
us.codecraft.webmagic.utils.ProxyUtils
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -45,7 +46,11 @@ public class SimpleProxyProvider implements ProxyProvider {
@Override
public
Proxy
getProxy
(
Task
task
)
{
return
proxies
.
get
(
incrForLoop
());
Proxy
proxy
;
do
{
proxy
=
proxies
.
get
(
incrForLoop
());
}
while
(!
ProxyUtils
.
validateProxy
(
proxy
));
return
proxy
;
}
private
int
incrForLoop
()
{
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/utils/ProxyUtils.java
View file @
4cc3b606
...
...
@@ -24,7 +24,7 @@ public class ProxyUtils {
try
{
socket
=
new
Socket
();
InetSocketAddress
endpointSocketAddr
=
new
InetSocketAddress
(
p
.
getHost
(),
p
.
getPort
());
socket
.
connect
(
endpointSocketAddr
,
30
00
);
socket
.
connect
(
endpointSocketAddr
,
1
00
);
return
true
;
}
catch
(
IOException
e
)
{
logger
.
warn
(
"FAILRE - CAN not connect! remote: "
+
p
);
...
...
webmagic-extension/pom.xml
View file @
4cc3b606
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-samples/pom.xml
View file @
4cc3b606
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-saxon/pom.xml
View file @
4cc3b606
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-scripts/pom.xml
View file @
4cc3b606
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.8.
6
-SNAPSHOT
</version>
<version>
0.8.
7
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
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