Compare commits
2 Commits
50332fba11
...
68ec9d52ed
Author | SHA1 | Date | |
---|---|---|---|
68ec9d52ed | |||
307745babe |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
target/
|
target/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
tomcat-binaries/
|
23
README.md
23
README.md
@ -1,3 +1,26 @@
|
|||||||
# amazon-scrapi
|
# amazon-scrapi
|
||||||
|
|
||||||
An API interface with Amazon, that uses webscraping
|
An API interface with Amazon, that uses webscraping
|
||||||
|
|
||||||
|
# Development Environment Setup
|
||||||
|
|
||||||
|
## VSCode / VSCodium
|
||||||
|
|
||||||
|
Install the following softwares
|
||||||
|
- Required for development
|
||||||
|
- Maven
|
||||||
|
- Java JDK
|
||||||
|
- Git
|
||||||
|
- Highly recommended for debugging or deployment
|
||||||
|
- [Apache Tomcat](https://tomcat.apache.org)
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
VSCode Extensions
|
||||||
|
- Extension Pack for Java
|
||||||
|
|
||||||
|
### Tomcat
|
||||||
|
Download binaries for Tomcat.
|
||||||
|
You can get a VSCode extension to deploying project to Tomcat for debugging.
|
||||||
|
Following these guides.
|
||||||
|
- Extension Setup [(Video](https://www.youtube.com/watch?v=R9mugpHWr14) - [Article)](https://www.brandondonnelson.com/2020/06/debugging-java-web-app-in-visual-studio.html).
|
||||||
|
- Helped understand config [(video)](https://www.youtube.com/watch?v=RiPot1ne8rI)
|
5
pom.xml
5
pom.xml
@ -28,6 +28,11 @@
|
|||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
|
<artifactId>playwright</artifactId>
|
||||||
|
<version>1.48.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -8,11 +8,28 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import com.microsoft.playwright.Browser;
|
||||||
|
import com.microsoft.playwright.Page;
|
||||||
|
import com.microsoft.playwright.Playwright;
|
||||||
|
|
||||||
public class App extends HttpServlet {
|
public class App extends HttpServlet {
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||||
|
String url = "https://amazon.com";
|
||||||
|
|
||||||
PrintWriter out = resp.getWriter();
|
PrintWriter out = resp.getWriter();
|
||||||
out.println("Hello!");
|
|
||||||
|
try (Playwright playwright = Playwright.create()) {
|
||||||
|
Browser browser = playwright.chromium().launch();
|
||||||
|
Page page = browser.newPage();
|
||||||
|
page.navigate(url);
|
||||||
|
|
||||||
|
page.
|
||||||
|
|
||||||
|
System.out.println(page.title());
|
||||||
|
out.println("Here is the page.title: " + page.title());
|
||||||
|
}
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/driver-1.48.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/driver-1.48.0.jar
Normal file
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/driver-bundle-1.48.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/driver-bundle-1.48.0.jar
Normal file
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/error_prone_annotations-2.27.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/error_prone_annotations-2.27.0.jar
Normal file
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/gson-2.11.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/gson-2.11.0.jar
Normal file
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/opentest4j-1.3.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/opentest4j-1.3.0.jar
Normal file
Binary file not shown.
BIN
src/main/webapp/WEB-INF/lib/playwright-1.48.0.jar
Normal file
BIN
src/main/webapp/WEB-INF/lib/playwright-1.48.0.jar
Normal file
Binary file not shown.
12
src/main/webapp/index.jsp
Normal file
12
src/main/webapp/index.jsp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Amazon Scrapi</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Amazon Scrapi</h2>
|
||||||
|
<hr />
|
||||||
|
<p>An API interface with amazon.com using webscraping</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user