Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit 844f808

Browse files
committed
#3 fix URL encoding
1 parent 9d4feb9 commit 844f808

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ InternetWayBackMachine
33

44
# Auto Submit URLs to web.archive.org
55

6-
The purpose of this application is to allow user to define a link and allow them to automatically submit to web.archive.org.
7-
The main benefit of this application is that the user doesn't require to open a browser and do the submission manually each time.
8-
In addition to that, the appliation can be configured in Linux crontab and do the task of submission preidically.
6+
The purpose of this application is to allow user to to automatically submit a link to web.archive.org.
7+
The main benefit of this application is that the user does not require to open a browser and do the submission manually each time.
8+
In addition to that, the application can be configured in Linux Crontab and do the task of submission periodically.
99
You can get more information about Internet Wayback Machine from
1010

1111
http://www.web.archive.org
@@ -37,5 +37,5 @@ GNU General Public License for more details. <http://www.gnu.org/licenses/>
3737

3838
Author(s):
3939

40-
© 2015-2018 Kasra Madadipouya <kasra@madadipouya.com>
40+
© 2015-2019 Kasra Madadipouya <kasra@madadipouya.com>
4141

src/CallWayBackMachine.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* GNU General Public License for more details. <http://www.gnu.org/licenses/>
1111
*
1212
* Author(s):
13-
* © 2015 Kasra Madadipouya <kasra@madadipouya.com>
13+
* © 2015-2019 Kasra Madadipouya <kasra@madadipouya.com>
1414
*/
1515
public class CallWayBackMachine
1616
{
@@ -21,7 +21,6 @@ public static void main(String[] args)
2121
if(args.length < 1)
2222
{
2323
System.out.println("No URL provided!");
24-
return;
2524
}
2625
else
2726
{

src/SubmitUrl.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
* GNU General Public License for more details. <http://www.gnu.org/licenses/>
1111
*
1212
* Author(s):
13-
* © 2015 Kasra Madadipouya <kasra@madadipouya.com>
13+
* © 2015-2019 Kasra Madadipouya <kasra@madadipouya.com>
1414
*/
1515
import java.io.BufferedReader;
1616
import java.io.InputStreamReader;
1717
import java.net.HttpURLConnection;
18+
import java.net.URI;
1819
import java.net.URL;
1920

2021
public class SubmitUrl
@@ -50,7 +51,11 @@ private boolean doSubmit()
5051
System.out.println("No URL provided!");
5152
throw new Exception();
5253
}
54+
5355
URL url = new URL(webArchiveUrl);
56+
57+
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
58+
url = new URL(uri.toASCIIString());
5459
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
5560
conn.setRequestMethod("GET");
5661
if(conn.getResponseCode() != 200)
@@ -68,14 +73,7 @@ private boolean doSubmit()
6873
//System.out.println(output);
6974
cnt++;
7075
}
71-
if(cnt>1)
72-
{
73-
return true;
74-
}
75-
else
76-
{
77-
return false;
78-
}
76+
return cnt>1;
7977
}
8078
catch(Exception ex)
8179
{

0 commit comments

Comments
 (0)