Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Commit

Permalink
Release v6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasbenb committed Apr 7, 2020
1 parent 198be2a commit ad61bc7
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 31 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ MagnetMagnet is well, a magnet link magnet, it's a scraper that allows you to sc
- Choosing the category/subcategory to scrape magnet links from
- Exporting magnet links to a .txt file in local directory
- Copy specific magnet links to the clipboard on click
- Auto version checker

## To do list:
- ~~Add Nyaa support~~
- ~~Add maximum scraping limit~~
- Add a self updater
- ~~Add a self updater~~
- Make scraping asynchronous

# Installation
Expand All @@ -35,21 +36,21 @@ MagnetMagnet is well, a magnet link magnet, it's a scraper that allows you to sc

# Usage:
### Home Screen:
- On launch you get five options of torrent indexers to scrape from: 1377x, KAT, Nyaa, RARBG and TPB,
- On launch you get five options of torrent indexers to scrape from: 1377x, Kick Ass Torrents, Nyaa, RARBG and The Pirate Bay
- There is also a sixth tab named 'Search' which allows you to scrape the aforementioned torrent indexers for specific words

![Home Screen](https://user-images.githubusercontent.com/54410649/78558052-fdc52b80-7822-11ea-939f-cd7868a084bd.PNG)
![Home Screen](https://user-images.githubusercontent.com/54410649/78696205-30008700-7910-11ea-8c33-480725e58e36.PNG)
### Search:
- In the Search app you have four user editable fields:
- **Checkboxes:** you can select/deselect the torrent indexers you would like to search from
- **Search box:** here you enter the search query you would like to scrape
- **Table:** the table displays the title names, seeders and leechers for the torrents scraped, here you can copy the magnet link you would like by selecting a row
- **Slider** the slider allows you to limit the amount of torrents scraped per torrent indexer

![Search](https://user-images.githubusercontent.com/54410649/78558044-fbfb6800-7822-11ea-9a36-ed6b0eff4a31.PNG)
![Search](https://user-images.githubusercontent.com/54410649/78696214-3131b400-7910-11ea-8306-5be6d2069886.PNG)
### Scrapers:
- There are only two user changeable fields in the scraper apps:
- **Domain:** the first field is for the domain, here just choose the torrent indexer's domain
- **Category:** the second field is for the category which you can choose from the drop down box

![Scrapers](https://user-images.githubusercontent.com/54410649/78558049-fdc52b80-7822-11ea-94e1-4cc48413ef75.PNG)
![Scrapers](https://user-images.githubusercontent.com/54410649/78696217-31ca4a80-7910-11ea-8d2d-4b26cf67a256.PNG)
63 changes: 45 additions & 18 deletions home.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
from PyQt5 import QtCore, QtGui, QtWidgets
from search import Ui_searchMainWindow
from imagebytes import *
import os, requests, re
import os, requests, re, webbrowser

path = '%s\\eliasbenb' % os.environ['APPDATA']
if not os.path.exists(path):
os.makedirs(path)
if not os.path.exists(path+r'\images'):
os.makedirs(path+r'\images')
if not os.path.exists(path+r'\images\github.png'):
with open(path+r'\images\github.png','wb') as w1:
w1.write(github_image_bytes)
with open(path+r'\images\github.png','wb') as w:
w.write(github_image_bytes)
if not os.path.exists(path+r'\images\icon.png'):
with open(path+r'\images\icon.png','wb') as w2:
w2.write(icon_image_bytes)
with open(path+r'\images\icon.png','wb') as w:
w.write(icon_image_bytes)
if not os.path.exists(path+r'\images\kat.png'):
with open(path+r'\images\kat.png','wb') as w3:
w3.write(kat_image_bytes)
with open(path+r'\images\kat.png','wb') as w:
w.write(kat_image_bytes)
if not os.path.exists(path+r'\images\nyaa.png'):
with open(path+r'\images\nyaa.png','wb') as w4:
w4.write(nyaa_image_bytes)
with open(path+r'\images\nyaa.png','wb') as w:
w.write(nyaa_image_bytes)
if not os.path.exists(path+r'\images\rarbg.png'):
with open(path+r'\images\rarbg.png','wb') as w5:
w5.write(rarbg_image_bytes)
with open(path+r'\images\rarbg.png','wb') as w:
w.write(rarbg_image_bytes)
if not os.path.exists(path+r'\images\tpb.png'):
with open(path+r'\images\tpb.png','wb') as w6:
w6.write(tpb_image_bytes)
with open(path+r'\images\tpb.png','wb') as w:
w.write(tpb_image_bytes)
if not os.path.exists(path+r'\images\website.png'):
with open(path+r'\images\website.png','wb') as w7:
w7.write(website_image_bytes)
with open(path+r'\images\website.png','wb') as w:
w.write(website_image_bytes)
if not os.path.exists(path+r'\images\x1377.png'):
with open(path+r'\images\x1377.png','wb') as w8:
w8.write(x1377_image_bytes)
with open(path+r'\images\x1377.png','wb') as w:
w.write(x1377_image_bytes)

class Ui_homeMainWindow(object):
def setupUi(self, homeMainWindow):
Expand Down Expand Up @@ -119,7 +119,34 @@ def setupUi(self, homeMainWindow):
self.retranslateUi(homeMainWindow)
QtCore.QMetaObject.connectSlotsByName(homeMainWindow)

def update_message():
updateMessageBox = QtWidgets.QMessageBox()
updateMessageBox.setIcon(QtWidgets.QMessageBox.Information)

updateMessageBox.setText("There is a newer version of MagnetMagnet. Would you like to update?")
updateMessageBox.setWindowTitle("Update Available!")
updateMessageBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
updateMessageBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(path+r"/images/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
updateMessageBox.setWindowIcon(icon)

updateMessageBox.buttonClicked.connect(update)

updateMessageBox.exec_()

def update():
webbrowser.open("https://github.com/eliasbenb/MagnetMagnet/releases/latest/")

__VERSION__ = "6.5"
version_request = requests.get("https://github.com/eliasbenb/MagnetMagnet/releases/latest/")
version_url = version_request.url
version_url = version_url.split("/")
latest_version = version_url[7]
if latest_version != __VERSION__:
update_message()

def retranslateUi(self, homeMainWindow):
_translate = QtCore.QCoreApplication.translate
homeMainWindow.setWindowTitle(_translate("homeMainWindow", "MagnetMagnet @eliasbenb"))
self.searchPushButton.setText(_translate("homeMainWindow", "Search"))
self.searchPushButton.setText(_translate("homeMainWindow", "Search"))
Binary file modified requirements.txt
Binary file not shown.
65 changes: 57 additions & 8 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def x1377():
seeder = page_soup.find('span', class_="seeds").text
leecher = page_soup.find('span', class_="leeches").text
size = page_soup.findAll('span')[15].text
date = page_soup.findAll('span')[19].text
magnet = page_soup.find('a', attrs={'href': re.compile("^magnet:?")}).get('href')

row_position = self.tableTableWidget.rowCount()
Expand All @@ -75,7 +76,8 @@ def x1377():
self.tableTableWidget.setItem(row_position, 1, QtWidgets.QTableWidgetItem(seeder))
self.tableTableWidget.setItem(row_position, 2, QtWidgets.QTableWidgetItem(leecher))
self.tableTableWidget.setItem(row_position, 3, QtWidgets.QTableWidgetItem(size))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem("1377x"))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem(date))
self.tableTableWidget.setItem(row_position, 5, QtWidgets.QTableWidgetItem("1377x"))
self.magnets.append(magnet)
limit_counter = limit_counter + 1

Expand All @@ -89,12 +91,14 @@ def kat():
seeders_soup = main_soup.findAll('td', class_="green center")
leechers_soup = main_soup.findAll('td', class_="red lasttd center")
sizes_soup = main_soup.findAll('td', class_="nobr center")
dates_soup = main_soup.findAll('td', class_="center", title=True)
magnets_soup = main_soup.findAll('a', attrs={'href': re.compile("^magnet:?"), 'title': "Torrent magnet link"})

titles = []
seeders = []
leechers = []
sizes = []
dates = []
limit_counter = 0
for title in titles_soup:
if limit_counter < limit:
Expand All @@ -116,6 +120,11 @@ def kat():
sizes.append(size.text)
limit_counter = limit_counter + 1
limit_counter = 0
for date in dates_soup:
if limit_counter < limit:
dates.append(date.text)
limit_counter = limit_counter + 1
limit_counter = 0
count1 = 0
for magnet in magnets_soup:
if limit_counter < limit:
Expand All @@ -131,7 +140,8 @@ def kat():
self.tableTableWidget.setItem(row_position, 1, QtWidgets.QTableWidgetItem(seeders[count2]))
self.tableTableWidget.setItem(row_position, 2, QtWidgets.QTableWidgetItem(leechers[count2]))
self.tableTableWidget.setItem(row_position, 3, QtWidgets.QTableWidgetItem(sizes[count2]))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem("KAT"))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem(dates[count2]))
self.tableTableWidget.setItem(row_position, 5, QtWidgets.QTableWidgetItem("KAT"))
count2 = count2 + 1

def nyaa():
Expand All @@ -144,12 +154,14 @@ def nyaa():
seeders_soup = main_soup.findAll('td', class_="text-center")
leechers_soup = main_soup.findAll('td', class_="text-center")
sizes_soup = main_soup.findAll('td', class_="text-center")
dates_soup = main_soup.findAll('td', class_="text-center")
magnets_soup = main_soup.findAll('a', attrs={'href': re.compile("^magnet:?")})

titles = []
seeders = []
leechers = []
sizes = []
dates = []
limit_counter = 0
for title in titles_soup:
if limit_counter < limit:
Expand All @@ -171,6 +183,11 @@ def nyaa():
sizes.append(size.text)
limit_counter = limit_counter + 1
limit_counter = 0
for date in dates_soup:
if limit_counter < limit*6:
dates.append(date.text)
limit_counter = limit_counter + 1
limit_counter = 0
count1 = 0
for magnet in magnets_soup:
if limit_counter < limit:
Expand Down Expand Up @@ -201,6 +218,13 @@ def nyaa():
sizes = sizes[6-1::6]
sizes.insert(0, size1)

date1 = dates[2]
dates.pop(0)
dates.pop(1)
dates.pop(2)
dates = dates[6-1::6]
dates.insert(0, date1)

count2 = 0
while count2 < count1:
row_position = self.tableTableWidget.rowCount()
Expand All @@ -209,7 +233,8 @@ def nyaa():
self.tableTableWidget.setItem(row_position, 1, QtWidgets.QTableWidgetItem(seeders[count2]))
self.tableTableWidget.setItem(row_position, 2, QtWidgets.QTableWidgetItem(leechers[count2]))
self.tableTableWidget.setItem(row_position, 3, QtWidgets.QTableWidgetItem(sizes[count2]))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem("Nyaa"))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem(dates[count2]))
self.tableTableWidget.setItem(row_position, 5, QtWidgets.QTableWidgetItem("Nyaa"))
count2 = count2 + 1

def rarbg():
Expand All @@ -222,12 +247,14 @@ def rarbg():
seeders_soup = main_soup.split(',"')
leechers_soup = main_soup.split(',"')
sizes_soup = main_soup.split(',"')
dates_soup = main_soup.split(',"')
magnets_soup = main_soup.split('"')

titles = []
seeders = []
leechers = []
sizes = []
dates = []
limit_counter = 0
for title in titles_soup:
if limit_counter < limit:
Expand Down Expand Up @@ -267,7 +294,14 @@ def convert_size(size):
size = int(size.replace('size":', ''))
convert_size(size)
limit_counter = limit_counter + 1

limit_counter = 0
for date in dates_soup:
if limit_counter < limit:
if date.startswith('pubdate":'):
date = date.replace('pubdate":"', '')
date = date.replace('+0000"', '')
dates.append(date)
limit_counter = limit_counter + 1
limit_counter = 0
count1 = 0
for magnet in magnets_soup:
Expand All @@ -285,7 +319,8 @@ def convert_size(size):
self.tableTableWidget.setItem(row_position, 1, QtWidgets.QTableWidgetItem(seeders[count2]))
self.tableTableWidget.setItem(row_position, 2, QtWidgets.QTableWidgetItem(leechers[count2]))
self.tableTableWidget.setItem(row_position, 3, QtWidgets.QTableWidgetItem(sizes[count2]))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem("RARBG"))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem(dates[count2]))
self.tableTableWidget.setItem(row_position, 5, QtWidgets.QTableWidgetItem("RARBG"))
count2 = count2 + 1

def tpb():
Expand All @@ -300,12 +335,14 @@ def tpb():
leechers_soup = main_soup.findAll('td', attrs={'align': "right"})
leechers_soup = leechers_soup[1::2]
sizes_soup = main_soup.findAll('font', class_="detDesc")
dates_soup = main_soup.findAll('font', class_="detDesc")
magnets_soup = main_soup.findAll('a', attrs={'href': re.compile("^magnet")})

titles = []
seeders = []
leechers = []
sizes = []
dates = []
limit_counter = 0
for title in titles_soup:
if limit_counter < limit:
Expand All @@ -329,6 +366,13 @@ def tpb():
size = size[1].replace("Size ", "")
sizes.append(size)
limit_counter = limit_counter + 1
limit_counter = 0
for date in dates_soup:
if limit_counter < limit:
date = date.text.split(", ")
date = date[0].replace("Uploaded ", "")
dates.append(date)
limit_counter = limit_counter + 1
count1 = 0
limit_counter = 0
for magnet in magnets_soup:
Expand All @@ -345,7 +389,8 @@ def tpb():
self.tableTableWidget.setItem(row_position, 1, QtWidgets.QTableWidgetItem(seeders[count2]))
self.tableTableWidget.setItem(row_position, 2, QtWidgets.QTableWidgetItem(leechers[count2]))
self.tableTableWidget.setItem(row_position, 3, QtWidgets.QTableWidgetItem(sizes[count2]))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem("TPB"))
self.tableTableWidget.setItem(row_position, 4, QtWidgets.QTableWidgetItem(dates[count2]))
self.tableTableWidget.setItem(row_position, 5, QtWidgets.QTableWidgetItem("TPB"))
count2 = count2 + 1

if (self.x1377CheckBox.isChecked() and self.katCheckBox.isChecked() and self.nyaaCheckBox.isChecked() and self.rarbgCheckBox.isChecked() and self.tpbCheckBox.isChecked()):
Expand Down Expand Up @@ -599,7 +644,7 @@ def setupUi(self, searchMainWindow):
self.tableTableWidget = QtWidgets.QTableWidget(self.centralwidget)
self.tableTableWidget.setGeometry(QtCore.QRect(260, 20, 1161, 360))
self.tableTableWidget.setObjectName("tableTableWidget")
self.tableTableWidget.setColumnCount(5)
self.tableTableWidget.setColumnCount(6)
self.tableTableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableTableWidget.setHorizontalHeaderItem(0, item)
Expand All @@ -611,6 +656,8 @@ def setupUi(self, searchMainWindow):
self.tableTableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableTableWidget.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableTableWidget.setHorizontalHeaderItem(5, item)
self.katCheckBox = QtWidgets.QCheckBox(self.centralwidget)
self.katCheckBox.setGeometry(QtCore.QRect(30, 110, 90, 20))
self.katCheckBox.setObjectName("katCheckBox")
Expand Down Expand Up @@ -671,11 +718,13 @@ def retranslateUi(self, searchMainWindow):
item = self.tableTableWidget.horizontalHeaderItem(3)
item.setText(_translate("searchMainWindow", "Sizes"))
item = self.tableTableWidget.horizontalHeaderItem(4)
item.setText(_translate("searchMainWindow", "Dates"))
item = self.tableTableWidget.horizontalHeaderItem(5)
item.setText(_translate("searchMainWindow", "Source"))
self.katCheckBox.setText(_translate("searchMainWindow", "KAT"))
self.nyaaCheckBox.setText(_translate("searchMainWindow", "Nyaa"))
self.rarbgCheckBox.setText(_translate("searchMainWindow", "RARBG"))
self.tpbCheckBox.setText(_translate("searchMainWindow", "TPB"))
self.searchPushButton.setText(_translate("searchMainWindow", "Search"))
self.minimumLabel.setText(_translate("searchMainWindow", "0"))
self.maximumLabel.setText(_translate("searchMainWindow", "20"))
self.maximumLabel.setText(_translate("searchMainWindow", "20"))

0 comments on commit ad61bc7

Please sign in to comment.