Skip to content

Commit a508c60

Browse files
committed
web scraping
1 parent 28fa772 commit a508c60

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"manifest_version": 3,
33
"name": "LeetCode Helper",
44
"version": "1.0",
5-
"description": "Get AI-powered help while solving LeetCode problems.",
6-
"permissions": [],
5+
"description": "Get AI-powered help while solving LeetCode problems",
6+
"permissions": ["activeTab", "scripting", "tabs"],
7+
"host_permissions": ["https://leetcode.com/*"],
78
"action": {
89
"default_popup": "popup.html",
910
"default_icon": {

popup.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
document.getElementById("getHelp").addEventListener("click", () => {
2-
alert("This will soon talk to your Django backend!");
1+
document.getElementById("getHelp").addEventListener("click", async () => {
2+
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
3+
const tab = tabs[0];
4+
const url = tab.url;
5+
const title = tab.title;
6+
7+
console.log("LeetCode URL:", url);
8+
console.log("Problem Title:", title);
9+
10+
// For tomorrow: send to Django here
11+
// fetch("http://127.0.0.1:8000/api/...", { method: "POST", body: ... })
12+
});
313
});

0 commit comments

Comments
 (0)