-
Notifications
You must be signed in to change notification settings - Fork 1
/
hunter.py
37 lines (31 loc) · 1017 Bytes
/
hunter.py
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
import time
from elithunter.elithunter import MovieLinks
from db.model import ModelSQLite
def fetch(base, website, m, start_id=None, end_id=None):
""" Fetchs the links.
base: Base address
webiste: Website address
m: SQL object
start_id: Starting link ID
end_id: Ending link ID
"""
if not start_id:
start_id = m.getLastId(website) + 1
end_id = start_id + 100
movies = MovieLinks(base, start_id, end_id)
links = movies.getLinks()
return links
def main():
try:
m = ModelSQLite()
print("Fetching MoviesBaba links...", end="")
moviesBaba = fetch("https://links.moviebaba.in/archives", "links.moviebaba.in", m)
time.sleep(60)
print("Fetching kmhd links...", end="")
kmhd = fetch("https://kmhd.pw/archives", "kmhd.pw", m)
links = moviesBaba + kmhd
m.create_items(sorted(links, key=lambda i:i["created_at"]))
except Exception as e:
print(e)
if __name__ == "__main__":
main()