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
|
||||
/config
|
||||
*.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]
|
||||
clap = { version = "4.5.7", features = ["derive"] }
|
||||
dotenv = "0.15.0"
|
||||
reqwest = "0.12.5"
|
||||
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 clap::{Parser, Subcommand};
|
||||
use rusqlite::Connection;
|
||||
use dotenv::dotenv;
|
||||
|
||||
mod bencode;
|
||||
|
||||
|
|
@ -205,6 +206,7 @@ fn index(db: Connection, path: &String) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
dotenv().ok();
|
||||
let args = Args::parse();
|
||||
let db = Connection::open(args.db_path).unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@ CREATE TABLE "file" (
|
|||
CREATE TABLE "category" (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
title TEXT NOT NULL,
|
||||
title TEXT,
|
||||
forum_id INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_category_forum_id ON "category"("forum_id");
|
||||
|
||||
CREATE TABLE "torrent_category" (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue