-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmedium.py
More file actions
58 lines (45 loc) · 1.24 KB
/
medium.py
File metadata and controls
58 lines (45 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from functions import (
searchGoogle,
SearchAuthorMedium,
)
from external import bcolors
import argparse,sys
parser = argparse.ArgumentParser(description="Medium Miner.")
word_group = parser.add_mutually_exclusive_group()
word_group.add_argument(
"-w",
"--word",
type=str,
help="Search by word in google example: python3 medium.py -w xss",
)
parser.add_argument(
"-c",
"--count",
type=int,
help="How many output you want? example: python3 medium.py -w idor -c 10",
)
parser.add_argument(
"-a",
"--author",
type=str,
help="Search by author in medium example: python3 medium.py -a ammarmosaber",
)
parser.add_argument("-v", action="store_true", help="Prints the program version")
args = parser.parse_args()
try:
if args.word:
if not args.count:
args.count = 10
searchGoogle(str(args.word), args.count)
elif args.author:
SearchAuthorMedium(args.author)
elif args.v:
print("1.0 Beta")
else:
print()
parser.print_help()
print()
except ValueError:
print(f"{bcolors.FAIL}Username is wrong or there is no blogs!{bcolors.ENDC}")
except:
print(f"{bcolors.FAIL}Something went wrong please try again!{bcolors.ENDC}")