prepare everything work scraping
This commit is contained in:
parent
d8581e6048
commit
11caaf9c24
5 changed files with 1787 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,4 +2,5 @@
|
||||||
/samples
|
/samples
|
||||||
/config
|
/config
|
||||||
*.txt
|
*.txt
|
||||||
*.db
|
*.db
|
||||||
|
*.env
|
||||||
1789
Cargo.lock
generated
1789
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -7,4 +7,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.7", features = ["derive"] }
|
clap = { version = "4.5.7", features = ["derive"] }
|
||||||
|
dotenv = "0.15.0"
|
||||||
|
reqwest = "0.12.5"
|
||||||
rusqlite = { version = "0.31.0", features = ["bundled"] }
|
rusqlite = { version = "0.31.0", features = ["bundled"] }
|
||||||
|
scraper = "0.19.0"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
use std::{fs::{self, DirEntry}, path::Path};
|
use std::{fs::{self, DirEntry}, path::Path, env};
|
||||||
use bencode::{decode, Value};
|
use bencode::{decode, Value};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
|
use dotenv::dotenv;
|
||||||
|
|
||||||
mod bencode;
|
mod bencode;
|
||||||
|
|
||||||
|
|
@ -205,6 +206,7 @@ fn index(db: Connection, path: &String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
dotenv().ok();
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let db = Connection::open(args.db_path).unwrap();
|
let db = Connection::open(args.db_path).unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,12 @@ CREATE TABLE "file" (
|
||||||
CREATE TABLE "category" (
|
CREATE TABLE "category" (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|
||||||
title TEXT NOT NULL,
|
title TEXT,
|
||||||
forum_id INTEGER NOT NULL
|
forum_id INTEGER NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX idx_category_forum_id ON "category"("forum_id");
|
||||||
|
|
||||||
CREATE TABLE "torrent_category" (
|
CREATE TABLE "torrent_category" (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue