Skip to content

Commit

Permalink
V1.0 Ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Agentspades committed Jul 1, 2021
1 parent 094f657 commit 429d27e
Show file tree
Hide file tree
Showing 9 changed files with 765 additions and 28 deletions.
621 changes: 621 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.Agentspades</groupId>
<artifactId>etsyScraperMaven</artifactId>
<name>etsyScraperMaven</name>
<version>1.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>com.agentspades.etsyscrapermaven.SearchGUI</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.target>15</maven.compiler.target>
<maven.compiler.source>15</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
18 changes: 18 additions & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<netbeans.hint.licensePath>${project.basedir}/licenseheaderC:\Users\Agentspades\Google Drive\Java\ETSY_Scraper\LICENSE.txt</netbeans.hint.licensePath>
</properties>
</project-shared-configuration>
42 changes: 33 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,44 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.Agentspades</groupId>
<artifactId>etsyScraper</artifactId>
<version>0.1</version>
<artifactId>etsyScraperMaven</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.50.0</version>
</dependency>
</dependencies>
<name>etsyScraper</name>
</project>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.agentspades.etsyscrapermaven.SearchGUI</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<name>etsyScraperMaven</name>
</project>
1 change: 1 addition & 0 deletions run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -jar etsyScraper-0.1-shaded.jar
19 changes: 15 additions & 4 deletions src/main/java/com/agentspades/etsyscrapermaven/SearchGUI.form
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
<Properties>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem2">
<Properties>
<Property name="text" type="java.lang.String" value="About"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
Expand Down Expand Up @@ -174,8 +189,6 @@
<Column editable="true" title="Title 2" type="java.lang.Object"/>
</Table>
</Property>
<Property name="showHorizontalLines" type="boolean" value="true"/>
<Property name="showVerticalLines" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
Expand All @@ -195,8 +208,6 @@
<Column editable="true" title="Title 2" type="java.lang.Object"/>
</Table>
</Property>
<Property name="showHorizontalLines" type="boolean" value="true"/>
<Property name="showVerticalLines" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
Expand Down
52 changes: 39 additions & 13 deletions src/main/java/com/agentspades/etsyscrapermaven/SearchGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Purpose: Scrape etsy search results to show listing tags
* Author: Agentspades
* Date: 1 Jul 2021
* ToDo:
* ToDo: Finish About JOptionPane
*/
package com.agentspades.etsyscrapermaven;

Expand All @@ -25,7 +25,7 @@
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import com.agentspades.etsyscrapermaven.SearchGUI;
import javax.swing.JOptionPane;

public class SearchGUI extends javax.swing.JFrame {

Expand Down Expand Up @@ -128,6 +128,8 @@ private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("ETSY | Scraper");
Expand Down Expand Up @@ -175,8 +177,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
"Title 1", "Title 2"
}
));
results_JTable.setShowHorizontalLines(true);
results_JTable.setShowVerticalLines(true);
jScrollPane2.setViewportView(results_JTable);

top_JTable.setModel(new javax.swing.table.DefaultTableModel(
Expand All @@ -196,8 +196,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
"Title 1", "Title 2"
}
));
top_JTable.setShowHorizontalLines(true);
top_JTable.setShowVerticalLines(true);
jScrollPane3.setViewportView(top_JTable);

top_JLabel.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
Expand All @@ -215,6 +213,18 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenuBar1.add(jMenu1);

jMenu2.setText("Help");

jMenuItem2.setText("About");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem2);

jMenuBar1.add(jMenu2);

setJMenuBar(jMenuBar1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
Expand Down Expand Up @@ -295,7 +305,7 @@ private void search_JButtonActionPerformed(java.awt.event.ActionEvent evt) {//GE
progress_JTextArea.setText("");
}//end if
//display the search URL in the JTextArea
progress_JTextArea.append("Proccessing: " +searchUrl);
progress_JTextArea.setText("Proccessing: " +searchUrl);
//start a new thread
new Thread(new scrapeHtmlUnit()).start();
}//end outer if
Expand All @@ -319,7 +329,7 @@ private void search_JButtonActionPerformed(java.awt.event.ActionEvent evt) {//GE
/**********************************************************/
private void reset_JButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_JButtonActionPerformed
//reset the searchUrl
searchUrl = "https://www.etsy.com/au/search?q=";
searchUrl = "https://www.etsy.com/search?q=";
//set the fields to blank
progress_JTextArea.setText("");
search_JTextField.setText("");
Expand All @@ -336,6 +346,19 @@ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
new proxySettingsGUI().setVisible(true);
}//GEN-LAST:event_jMenuItem1ActionPerformed

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
//store the about message in a String variable
String aboutText = "This program has been created by Agentspades "
+ "(July, 2021) under the GNU/GPL V3.0 license."
+ "\nusing the below third party library"
+ "\n\nHtmlUnit v2.5.0 \nhttps://htmlunit.sourceforge.io"
+ "\n\nContact: [email protected]"
+ "\nhttps://github.com/Agentspades/ETSY_Scraper";
//show a JOptionPane with about info
JOptionPane.showMessageDialog(null, aboutText, "About",
JOptionPane.INFORMATION_MESSAGE);
}//GEN-LAST:event_jMenuItem2ActionPerformed

/**********************************************************/
// Method: public void clearTable()
// Purpose: Clears the tables contents
Expand Down Expand Up @@ -371,8 +394,6 @@ public void clearTable(int type){
/**********************************************************/
private class scrapeHtmlUnit implements Runnable{
public void run(){
//clear the progress window
progress_JTextArea.setText("");
//decalre variables
HtmlPage resultsPage = null;
List<String> linkList = new LinkedList<String>();
Expand All @@ -384,7 +405,7 @@ public void run(){
//this is to fetch more results to overcome the infinite scrolling
client.getOptions().setScreenHeight(600000);
//if if a proxy has been specified if not then use the users IP
if(!proxyIP.isEmpty() && proxyPort != 0){
if(proxyIP == null && proxyPort != 0){
ProxyConfig proxyConfig = new ProxyConfig(proxyIP, proxyPort, null);
client.getOptions().setProxyConfig(proxyConfig);
}//end if
Expand Down Expand Up @@ -414,9 +435,8 @@ public void run(){
//set progress text
progress_JTextArea.setText(progress_JTextArea.getText()+
"\nScraping ...");
//clear the tables
//clear the table
clearTable(1);
clearTable(2);
//loop through each link fetched from the search results
for(String link : linkList){
//set String variables to blank
Expand Down Expand Up @@ -469,6 +489,8 @@ public void run(){
//set progress text
progress_JTextArea.setText(progress_JTextArea.getText()+
"\nSequence Complete!");
//reset the searchUrl
searchUrl = "https://www.etsy.com/search?q=";
//end the thread
return;
}//end run()
Expand All @@ -481,6 +503,8 @@ public void run(){
// Outputs: void
/**********************************************************/
private void countTags(){
//clear the top tags table
clearTable(2);
//set progress text
progress_JTextArea.setText(progress_JTextArea.getText()+ "\nCounting the tags used");
//declare empty String variables
Expand Down Expand Up @@ -605,8 +629,10 @@ public void run() {

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<Component id="set_JButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="proxyList_JButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="10" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Purpose: get the users proxy settings
* Author: Agentspades
* Date: 1 Jul 2021
* ToDo:
* ToDo: Validate IP input
*/
package com.agentspades.etsyscrapermaven;

Expand Down

0 comments on commit 429d27e

Please sign in to comment.