Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Feb 1, 2019
0 parents commit f6bddc3
Show file tree
Hide file tree
Showing 19 changed files with 857 additions and 0 deletions.
103 changes: 103 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Newton Scamander

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# btScraper
BitTorrent Scraping Provider for [Seren](https://github.com/nixgates/plugin.video.seren)
7 changes: 7 additions & 0 deletions meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"author": "newt-sc",
"version":"0.0.1",
"name":"btScraper",
"update_directory": "https://github.com/newt-sc/btScraper/archive/",
"remote_meta": "https://raw.githubusercontent.com/newt-sc/btScraper/master/meta.json"
}
Empty file added providers/btScraper/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions providers/btScraper/en/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

import torrent

def get_torrent():
return torrent.__all__
45 changes: 45 additions & 0 deletions providers/btScraper/en/torrent/1337x.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

from lib import core

class sources:
def __init__(self):
self.base_link = "https://1337x.to"
self.search_link = "/search/%s/1/"
self.request = core.Request()

def search_request(self, query):
url = self.base_link + self.search_link % core.quote_plus(query)
return self.request.get(url)

def soup_filter(self, soup):
return soup.find_all('tr')

def title_filter(self, el):
return el.find_all('a')[1].text

def info(self, torrent, torrent_info):
url = torrent_info.el.find_all('a')[1]['href']
response = self.request.get(self.base_link + url)

torrent['magnet'] = core.re.findall(r'"(magnet:?.*?)"', response.text)[0]

try:
size = core.re.findall(r'<strong>Total size</strong> <span>(.*?)</span>', response.text)[0]
torrent['size'] = core.source_utils.de_string_size(size)
except: pass

try:
torrent['seeds'] = core.re.findall(r'<strong>Seeders</strong> <span class="seeds">(.*?)</span>', response.text)[0]
except: pass

return torrent

def get_scraper(self):
return core.TorrentScraper(self.search_request, self.soup_filter, self.title_filter, self.info, use_thread_for_info=True)

def movie(self, title, year):
return self.get_scraper().movie_query(title, year)

def episode(self, simple_info, all_info):
return self.get_scraper().episode_query(simple_info)
6 changes: 6 additions & 0 deletions providers/btScraper/en/torrent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

import os.path

files = os.listdir(os.path.dirname(__file__))
__all__ = [filename[:-3] for filename in files if not filename.startswith('__') and filename.endswith('.py')]
42 changes: 42 additions & 0 deletions providers/btScraper/en/torrent/bitlord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-

from lib import core

class sources:
def __init__(self):
self.base_link = 'https://bitlordsearch.com'
self.search_link = '/search?q=%s'
self.request = core.Request()

def search_request(self, query):
url = self.base_link + self.search_link % core.quote_plus(query)
return self.request.get(url)

def soup_filter(self, soup):
return soup.find_all('tr', {'class': 'bls-row'})

def title_filter(self, el):
return el.find_all('span', {'class': 'title'})[0].text

def info(self, torrent, torrent_info):
el = torrent_info.el
torrent['magnet'] = el.find('a', {'magnet-button'})['href']

try:
torrent['size'] = int(el.find('td', {'class': 'size'}).text)
except: pass

try:
torrent['seeds'] = int(el.find('td', {'class': 'seeds'}).text)
except: pass

return torrent

def get_scraper(self):
return core.TorrentScraper(self.search_request, self.soup_filter, self.title_filter, self.info)

def movie(self, title, year):
return self.get_scraper().movie_query(title, year)

def episode(self, simple_info, all_info):
return self.get_scraper().episode_query(simple_info)
40 changes: 40 additions & 0 deletions providers/btScraper/en/torrent/eztv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-

from lib import core

class sources:
def __init__(self):
self.base_link = 'https://eztv.ag'
self.search_link = '/search/%s'
self.request = core.Request()

def search_request(self, query):
url = self.base_link + self.search_link % core.quote_plus(query)
return self.request.get(url)

def soup_filter(self, soup):
return soup.find_all('tr', {'class': 'forum_header_border'})

def title_filter(self, el):
return el.find('a', {'class': 'epinfo'}).text

def info(self, torrent, torrent_info):
el = torrent_info.el
torrent['magnet'] = el.find('a', {'class': 'magnet'})['href']

try:
size = el.find_all('td')[3].text
torrent['size'] = core.source_utils.de_string_size(size)
except: pass

try:
torrent['seeds'] = el.find_all('td')[5].text
except: pass

return torrent

def get_scraper(self):
return core.TorrentScraper(self.search_request, self.soup_filter, self.title_filter, self.info)

def episode(self, simple_info, all_info):
return self.get_scraper().episode_query(simple_info)
44 changes: 44 additions & 0 deletions providers/btScraper/en/torrent/katcr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-

from lib import core

class sources:
def __init__(self):
self.base_link = 'https://katcr.co'
self.search_link = '/katsearch/page/1/%s'
self.request = core.Request()

def search_request(self, query):
url = self.base_link + self.search_link % core.quote_plus(query)
return self.request.get(url)

def soup_filter(self, el):
return el.find_all('tr')

def title_filter(self, el):
return el.find('a', {'class', 'torrents_table__torrent_title'}).text

def info(self, torrent, torrent_info):
el = torrent_info.el
torrent['magnet'] = el.find('a', {'title': 'Torrent magnet link'})['href']

try:
size = el.find('td', {'data-title': 'Size'}).text
torrent['size'] = core.source_utils.de_string_size(size)
except: pass

try:
seeds = el.find('td', {'data-title': 'Seed'}).text.replace(',', '')
torrent['seeds'] = int(seeds)
except: pass

return torrent

def get_scraper(self):
return core.TorrentScraper(self.search_request, self.soup_filter, self.title_filter, self.info)

def movie(self, title, year):
return self.get_scraper().movie_query(title, year)

def episode(self, simple_info, all_info):
return self.get_scraper().episode_query(simple_info)
Empty file.
Loading

0 comments on commit f6bddc3

Please sign in to comment.