1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import requests
- import sys
- from bs4 import BeautifulSoup as bs
- from plugins.plugin import Plugin
- sys.path.append("..")
- from src.video import Video
- from src.history import History
- from src.config import Config
- class LordFilmsSearch(Plugin):
- def __init__(self, history: History=History(), config: Config=Config()) -> None:
- super().__init__(history, config)
- self.history = history
- self.config = config
- self.name = "[-] LordFilms: Search"
- self.category = "LordFilms"
- self.params = {
- 'query' : True
- }
- self.flag = "-lfs"
- self.full_flag = "--lordfilmssearch"
- self.flag_help = "show films from lordfilms mirror"
- self.flag_action = "store_true"
- def get_search(self, search):
- torrents = list()
- html = requests.get("https://torrenther.com/")
- soup = bs(html.text, 'html.parser')
- for video_box in soup.find_all("div", {"class": "d1shortss"}):
- vpage_url = video_box.find("a", href=True)['href']
- title = video_box.find("a", {"class" : "d1short-name"}).text
- v_html = requests.get(vpage_url)
- v_soup = bs(v_html.text, 'html.parser')
- torrent_url = v_soup.find("div", {"id": "download"}).find("a", href=True)['href']
- print(title, torrent_url)
- torrent = Torrent(title=title, url=torrent_url)
- torrents.append(torrent.to_json())
-
- return torrents
- def get_torrents(self):
- torrents = self.get_torrenther()
-
- return torrents
- def get_items(self, params):
- query = ""
- if 'query' in params:
- query = params['query']
- return self.get_films(query)
|