libgenbulk
Owner: IIIlllIIIllI URL: git@github.com:nyangkosense/libgenbulk.git
lua script for selective approach
Commit deeff3a60977698085ab6d20960b679add83de13 by SM <seb.michalk@gmail.com> on 2025-05-21 07:17:56 +0200
diff --git a/downloader b/downloader
deleted file mode 100755
index b5a7ccb..0000000
Binary files a/downloader and /dev/null differ
diff --git a/gen_list_of_URLs.lua b/gen_list_of_URLs.lua
new file mode 100644
index 0000000..45d79ef
--- /dev/null
+++ b/gen_list_of_URLs.lua
@@ -0,0 +1,36 @@
+-- for a more selective approach, a small helper script to parse the linksfile and select each Link containing
+-- these keywords and save them in a file.
+-- the result is a output.txt file containing Links of URLs matching these Words for filtered Downloading
+local strarr = {"Biology", "Computer"}
+
+local file = io.open("links.txt", "r")
+if not file then
+ error("error opening file ... ")
+end
+
+local matches = {}
+for line in file:lines() do
+ for _, target in ipairs(strarr) do
+ -- Escape any special pattern characters in the target string
+ local escaped_target = string.gsub(target, "([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1")
+
+ -- Use plain text matching (third parameter as true) to avoid pattern matching
+ if string.find(line, escaped_target, 1, true) then
+ table.insert(matches, line)
+ break
+ end
+ end
+end
+
+file:close()
+
+local outfile = io.open("output.txt", "w")
+if not outfile then
+ error("error opening output file ... ")
+end
+
+for _, line in ipairs(matches) do
+ outfile:write(line .. "\n")
+end
+outfile:close()
+print("done...")
diff --git a/misc/select_random_urls.sh b/misc/select_random_urls.sh
deleted file mode 100755
index 0063d13..0000000
--- a/misc/select_random_urls.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-N="$1"
-INPUT="$2"
-OUTPUT="$3"
-
-if [[ -z "$N" || -z "$INPUT" || -z "$OUTPUT" ]]; then
- echo "Usage: $0 <number_of_lines> <input_file> <output_file>"
- exit 1
-fi
-
-shuf -n "$N" "$INPUT" > "$OUTPUT"
-
diff --git a/parser b/parser
deleted file mode 100755
index 9d24345..0000000
Binary files a/parser and /dev/null differ