├── .gitattributes ├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── LICENSE ├── README.md ├── docs ├── qbittorrent_torznab_search_1.png ├── qbittorrent_torznab_search_2.png ├── qbittorrent_torznab_search_3.png ├── qbittorrent_torznab_search_4.png ├── qbittorrent_torznab_search_5.png ├── qbittorrent_torznab_search_6.png ├── qbittorrent_torznab_search_7.png └── qbittorrent_torznab_search_8.png └── nova3 └── engines ├── __init__.py ├── eztv.py ├── jackett.py ├── limetorrents.py ├── piratebay.py ├── rarbg.py ├── solidtorrents.py ├── torlock.py ├── torrentproject.py ├── torrentscsv.py └── versions.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | core.eol=lf 2 | * text eol=lf 3 | 4 | # (binary is a macro for -text -diff) 5 | *.png binary 6 | *.jpg binary 7 | *.jpeg binary 8 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: {} 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 9 | cancel-in-progress: ${{ github.head_ref != '' }} 10 | 11 | jobs: 12 | ci: 13 | name: Check 14 | runs-on: ubuntu-latest 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev'] 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v3 23 | 24 | - name: Setup python 25 | uses: actions/setup-python@v4 26 | with: 27 | python-version: ${{ matrix.python-version }} 28 | 29 | - name: Install tools 30 | run: pip install bandit pycodestyle pyflakes 31 | 32 | - name: Lint code 33 | run: | 34 | pyflakes nova3/engines/*.py 35 | bandit --skip B110,B314,B405 nova3/engines/*.py 36 | 37 | - name: Format code 38 | run: | 39 | # skipping E265, fixing it will break plugin usage on older qbt instances (< v4.1.2) 40 | pycodestyle \ 41 | --ignore=E265,W503 \ 42 | --max-line-length=100 \ 43 | --statistics \ 44 | nova3/engines/*.py 45 | 46 | - name: Build code 47 | run: | 48 | python -m compileall nova3/engines/*.py 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Editors 2 | .vscode/ 3 | .idea/ 4 | 5 | # Python 6 | *.pyc 7 | 8 | # Plugin config 9 | /nova3/engines/jackett.json 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Search Plugins 2 | === 3 | [![GitHub Actions CI Status](https://github.com/qbittorrent/search-plugins/workflows/CI/badge.svg)](https://github.com/qbittorrent/search-plugins/actions) 4 | 5 | This repository contains search plugins for the search feature in [qBittorrent](https://github.com/qbittorrent/qBittorrent). 6 | 7 | :warning: We removed support for Python 2. Please, upgrade to Python 3 to continue using the search function. 8 | 9 | Jackett search plugin is enabled by default but you have to install an external program to make it work. You can disable the Jackett search plugin or [install Jackett](https://github.com/qbittorrent/search-plugins/wiki/How-to-configure-Jackett-plugin). 10 | 11 | Most probably, you want to head over to the [wiki](https://github.com/qbittorrent/search-plugins/wiki): 12 | * [List of unofficial search plugins](https://github.com/qbittorrent/search-plugins/wiki/Unofficial-search-plugins) 13 | * [Request unofficial search plugin](https://github.com/qbittorrent/search-plugins/wiki/Request-unofficial-search-plugin) 14 | * [How to configure Jackett plugin](https://github.com/qbittorrent/search-plugins/wiki/How-to-configure-Jackett-plugin) 15 | * [How to write a search plugin](https://github.com/qbittorrent/search-plugins/wiki/How-to-write-a-search-plugin) 16 | * [How to install search plugins](https://github.com/qbittorrent/search-plugins/wiki/Install-search-plugins) 17 | * [New Torznab search engine](https://github.com/qbittorrent/search-plugins/wiki/New-Torznab-search-engine) 18 | 19 | Everyone is welcome to submit PRs that fix problems or add new plugins. 20 | 21 | This repository isn't managed by the core team directly. Its purpose is to allow a place where 3rd party contributors can gather and submit their plugins. 22 | 23 | **Use the plugins and the websites they refer to at your own risk. You are personally responsible for following your country's copyright laws.** 24 | -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_1.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_2.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_3.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_4.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_5.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_6.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_7.png -------------------------------------------------------------------------------- /docs/qbittorrent_torznab_search_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/docs/qbittorrent_torznab_search_8.png -------------------------------------------------------------------------------- /nova3/engines/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngosang/search-plugins/60a3f4d9c97a5d1f94e75789a72ee054044c5802/nova3/engines/__init__.py -------------------------------------------------------------------------------- /nova3/engines/eztv.py: -------------------------------------------------------------------------------- 1 | #VERSION: 1.14 2 | # AUTHORS: nindogo 3 | # CONTRIBUTORS: Diego de las Heras (ngosang@hotmail.es) 4 | 5 | from html.parser import HTMLParser 6 | 7 | from novaprinter import prettyPrinter 8 | from helpers import retrieve_url 9 | 10 | 11 | class eztv(object): 12 | name = "EZTV" 13 | url = 'https://eztv.re' 14 | supported_categories = {'all': 'all', 'tv': 'tv'} 15 | 16 | class MyHtmlParser(HTMLParser): 17 | A, TD, TR, TABLE = ('a', 'td', 'tr', 'table') 18 | 19 | """ Sub-class for parsing results """ 20 | def __init__(self, url): 21 | HTMLParser.__init__(self) 22 | self.url = url 23 | 24 | self.in_table_row = False 25 | self.current_item = {} 26 | 27 | def handle_starttag(self, tag, attrs): 28 | params = dict(attrs) 29 | 30 | if (params.get('class') == 'forum_header_border' 31 | and params.get('name') == 'hover'): 32 | self.in_table_row = True 33 | self.current_item = {} 34 | self.current_item['seeds'] = -1 35 | self.current_item['leech'] = -1 36 | self.current_item['size'] = -1 37 | self.current_item['engine_url'] = self.url 38 | 39 | if (tag == self.A 40 | and self.in_table_row and params.get('class') == 'magnet'): 41 | self.current_item['link'] = params.get('href') 42 | 43 | if (tag == self.A 44 | and self.in_table_row and params.get('class') == 'epinfo'): 45 | self.current_item['desc_link'] = self.url + params.get('href') 46 | self.current_item['name'] = params.get('title').split(' (')[0] 47 | 48 | def handle_data(self, data): 49 | data = data.replace(',', '') 50 | if (self.in_table_row 51 | and (data.endswith(' KB') or data.endswith(' MB') or data.endswith(' GB'))): 52 | self.current_item['size'] = data 53 | 54 | elif self.in_table_row and data.isnumeric(): 55 | self.current_item['seeds'] = int(data) 56 | 57 | def handle_endtag(self, tag): 58 | if self.in_table_row and tag == self.TR: 59 | prettyPrinter(self.current_item) 60 | self.in_table_row = False 61 | 62 | def search(self, what, cat='all'): 63 | query = self.url + '/search/' + what.replace('%20', '-') 64 | eztv_html = retrieve_url(query) 65 | 66 | eztv_parser = self.MyHtmlParser(self.url) 67 | eztv_parser.feed(eztv_html) 68 | eztv_parser.close() 69 | 70 | 71 | if __name__ == '__main__': 72 | eztv_se = eztv() 73 | eztv_se.search('Acre', 'all') 74 | -------------------------------------------------------------------------------- /nova3/engines/jackett.py: -------------------------------------------------------------------------------- 1 | #VERSION: 4.0 2 | # AUTHORS: Diego de las Heras (ngosang@hotmail.es) 3 | # CONTRIBUTORS: ukharley 4 | # hannsen (github.com/hannsen) 5 | # Alexander Georgievskiy 6 | 7 | import json 8 | import os 9 | import xml.etree.ElementTree 10 | from urllib.parse import urlencode, unquote 11 | from urllib import request as urllib_request 12 | from http.cookiejar import CookieJar 13 | from multiprocessing.dummy import Pool 14 | from threading import Lock 15 | 16 | from novaprinter import prettyPrinter 17 | from helpers import download_file 18 | 19 | 20 | ############################################################################### 21 | # load configuration from file 22 | CONFIG_FILE = 'jackett.json' 23 | CONFIG_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), CONFIG_FILE) 24 | CONFIG_DATA = { 25 | 'api_key': 'YOUR_API_KEY_HERE', # jackett api 26 | 'url': 'http://127.0.0.1:9117', # jackett url 27 | 'tracker_first': False, # (False/True) add tracker name to beginning of search result 28 | 'thread_count': 20, # number of threads to use for http requests 29 | } 30 | PRINTER_THREAD_LOCK = Lock() 31 | 32 | 33 | def load_configuration(): 34 | global CONFIG_PATH, CONFIG_DATA 35 | try: 36 | # try to load user data from file 37 | with open(CONFIG_PATH) as f: 38 | CONFIG_DATA = json.load(f) 39 | except ValueError: 40 | # if file exists, but it's malformed we load add a flag 41 | CONFIG_DATA['malformed'] = True 42 | except Exception: 43 | # if file doesn't exist, we create it 44 | save_configuration() 45 | 46 | # do some checks 47 | if any(item not in CONFIG_DATA for item in ['api_key', 'tracker_first', 'url']): 48 | CONFIG_DATA['malformed'] = True 49 | 50 | # add missing keys 51 | if 'thread_count' not in CONFIG_DATA: 52 | CONFIG_DATA['thread_count'] = 20 53 | save_configuration() 54 | 55 | 56 | def save_configuration(): 57 | global CONFIG_PATH, CONFIG_DATA 58 | with open(CONFIG_PATH, 'w') as f: 59 | f.write(json.dumps(CONFIG_DATA, indent=4, sort_keys=True)) 60 | 61 | 62 | load_configuration() 63 | ############################################################################### 64 | 65 | 66 | class jackett(object): 67 | name = 'Jackett' 68 | url = CONFIG_DATA['url'] if CONFIG_DATA['url'][-1] != '/' else CONFIG_DATA['url'][:-1] 69 | api_key = CONFIG_DATA['api_key'] 70 | thread_count = CONFIG_DATA['thread_count'] 71 | supported_categories = { 72 | 'all': None, 73 | 'anime': ['5070'], 74 | 'books': ['8000'], 75 | 'games': ['1000', '4000'], 76 | 'movies': ['2000'], 77 | 'music': ['3000'], 78 | 'software': ['4000'], 79 | 'tv': ['5000'], 80 | } 81 | 82 | def download_torrent(self, download_url): 83 | # fix for some indexers with magnet link inside .torrent file 84 | if download_url.startswith('magnet:?'): 85 | print(download_url + " " + download_url) 86 | response = self.get_response(download_url) 87 | if response is not None and response.startswith('magnet:?'): 88 | print(response + " " + download_url) 89 | else: 90 | print(download_file(download_url)) 91 | 92 | def search(self, what, cat='all'): 93 | what = unquote(what) 94 | category = self.supported_categories[cat.lower()] 95 | 96 | # check for malformed configuration 97 | if 'malformed' in CONFIG_DATA: 98 | self.handle_error("malformed configuration file", what) 99 | return 100 | 101 | # check api_key 102 | if self.api_key == "YOUR_API_KEY_HERE": 103 | self.handle_error("api key error", what) 104 | return 105 | 106 | # search in Jackett API 107 | if self.thread_count > 1: 108 | args = [] 109 | indexers = self.get_jackett_indexers(what) 110 | for indexer in indexers: 111 | args.append((what, category, indexer)) 112 | with Pool(min(len(indexers), self.thread_count)) as pool: 113 | pool.starmap(self.search_jackett_indexer, args) 114 | else: 115 | self.search_jackett_indexer(what, category, 'all') 116 | 117 | def get_jackett_indexers(self, what): 118 | params = [ 119 | ('apikey', self.api_key), 120 | ('t', 'indexers'), 121 | ('configured', 'true') 122 | ] 123 | params = urlencode(params) 124 | jacket_url = self.url + "/api/v2.0/indexers/all/results/torznab/api?%s" % params 125 | response = self.get_response(jacket_url) 126 | if response is None: 127 | self.handle_error("connection error getting indexer list", what) 128 | return 129 | # process results 130 | response_xml = xml.etree.ElementTree.fromstring(response) 131 | indexers = [] 132 | for indexer in response_xml.findall('indexer'): 133 | indexers.append(indexer.attrib['id']) 134 | return indexers 135 | 136 | def search_jackett_indexer(self, what, category, indexer_id): 137 | # prepare jackett url 138 | params = [ 139 | ('apikey', self.api_key), 140 | ('q', what) 141 | ] 142 | if category is not None: 143 | params.append(('cat', ','.join(category))) 144 | params = urlencode(params) 145 | jacket_url = self.url + "/api/v2.0/indexers/" + indexer_id + "/results/torznab/api?%s" % params # noqa 146 | response = self.get_response(jacket_url) 147 | if response is None: 148 | self.handle_error("connection error for indexer: " + indexer_id, what) 149 | return 150 | # process search results 151 | response_xml = xml.etree.ElementTree.fromstring(response) 152 | for result in response_xml.find('channel').findall('item'): 153 | res = {} 154 | 155 | title = result.find('title') 156 | if title is not None: 157 | title = title.text 158 | else: 159 | continue 160 | 161 | tracker = result.find('jackettindexer') 162 | tracker = '' if tracker is None else tracker.text 163 | if CONFIG_DATA['tracker_first']: 164 | res['name'] = '[%s] %s' % (tracker, title) 165 | else: 166 | res['name'] = '%s [%s]' % (title, tracker) 167 | 168 | res['link'] = result.find(self.generate_xpath('magneturl')) 169 | if res['link'] is not None: 170 | res['link'] = res['link'].attrib['value'] 171 | else: 172 | res['link'] = result.find('link') 173 | if res['link'] is not None: 174 | res['link'] = res['link'].text 175 | else: 176 | continue 177 | 178 | res['size'] = result.find('size') 179 | res['size'] = -1 if res['size'] is None else (res['size'].text + ' B') 180 | 181 | res['seeds'] = result.find(self.generate_xpath('seeders')) 182 | res['seeds'] = -1 if res['seeds'] is None else int(res['seeds'].attrib['value']) 183 | 184 | res['leech'] = result.find(self.generate_xpath('peers')) 185 | res['leech'] = -1 if res['leech'] is None else int(res['leech'].attrib['value']) 186 | 187 | if res['seeds'] != -1 and res['leech'] != -1: 188 | res['leech'] -= res['seeds'] 189 | 190 | res['desc_link'] = result.find('comments') 191 | if res['desc_link'] is not None: 192 | res['desc_link'] = res['desc_link'].text 193 | else: 194 | res['desc_link'] = result.find('guid') 195 | res['desc_link'] = '' if res['desc_link'] is None else res['desc_link'].text 196 | 197 | # note: engine_url can't be changed, torrent download stops working 198 | res['engine_url'] = self.url 199 | 200 | self.pretty_printer_thread_safe(res) 201 | 202 | def generate_xpath(self, tag): 203 | return './{http://torznab.com/schemas/2015/feed}attr[@name="%s"]' % tag 204 | 205 | def get_response(self, query): 206 | response = None 207 | try: 208 | # we can't use helpers.retrieve_url because of redirects 209 | # we need the cookie processor to handle redirects 210 | opener = urllib_request.build_opener(urllib_request.HTTPCookieProcessor(CookieJar())) 211 | response = opener.open(query).read().decode('utf-8') 212 | except urllib_request.HTTPError as e: 213 | # if the page returns a magnet redirect, used in download_torrent 214 | if e.code == 302: 215 | response = e.url 216 | except Exception: 217 | pass 218 | return response 219 | 220 | def handle_error(self, error_msg, what): 221 | # we need to print the search text to be displayed in qBittorrent when 222 | # 'Torrent names only' is enabled 223 | self.pretty_printer_thread_safe({ 224 | 'seeds': -1, 225 | 'size': -1, 226 | 'leech': -1, 227 | 'engine_url': self.url, 228 | 'link': self.url, 229 | 'desc_link': 'https://github.com/qbittorrent/search-plugins/wiki/How-to-configure-Jackett-plugin', # noqa 230 | 'name': "Jackett: %s! Right-click this row and select 'Open description page' to open help. Configuration file: '%s' Search: '%s'" % (error_msg, CONFIG_PATH, what) # noqa 231 | }) 232 | 233 | def pretty_printer_thread_safe(self, dictionary): 234 | global PRINTER_THREAD_LOCK 235 | with PRINTER_THREAD_LOCK: 236 | prettyPrinter(self.escape_pipe(dictionary)) 237 | 238 | def escape_pipe(self, dictionary): 239 | # Safety measure until it's fixed in prettyPrinter 240 | for key in dictionary.keys(): 241 | if isinstance(dictionary[key], str): 242 | dictionary[key] = dictionary[key].replace('|', '%7C') 243 | return dictionary 244 | 245 | 246 | if __name__ == "__main__": 247 | jackett_se = jackett() 248 | jackett_se.search("ubuntu server", 'software') 249 | -------------------------------------------------------------------------------- /nova3/engines/limetorrents.py: -------------------------------------------------------------------------------- 1 | #VERSION: 4.7 2 | # AUTHORS: Lima66 3 | # CONTRIBUTORS: Diego de las Heras (ngosang@hotmail.es) 4 | 5 | import re 6 | from html.parser import HTMLParser 7 | from urllib.parse import quote 8 | 9 | from novaprinter import prettyPrinter 10 | from helpers import retrieve_url 11 | 12 | # Fix invalid certificate in Windows 13 | import ssl 14 | ssl._create_default_https_context = ssl._create_unverified_context 15 | 16 | 17 | class limetorrents(object): 18 | url = "https://www.limetorrents.lol" 19 | name = "LimeTorrents" 20 | supported_categories = {'all': 'all', 21 | 'anime': 'anime', 22 | 'software': 'applications', 23 | 'games': 'games', 24 | 'movies': 'movies', 25 | 'music': 'music', 26 | 'tv': 'tv'} 27 | 28 | class MyHtmlParser(HTMLParser): 29 | """ Sub-class for parsing results """ 30 | 31 | def error(self, message): 32 | pass 33 | 34 | A, TD, TR, HREF = ('a', 'td', 'tr', 'href') 35 | 36 | def __init__(self, url): 37 | HTMLParser.__init__(self) 38 | self.url = url 39 | self.current_item = {} # dict for found item 40 | self.item_name = None # key's name in current_item dict 41 | self.page_empty = 22000 42 | self.inside_tr = False 43 | self.findTable = False 44 | self.parser_class = {"tdnormal": "size", # class 45 | "tdseed": "seeds", 46 | "tdleech": "leech"} 47 | 48 | def handle_starttag(self, tag, attrs): 49 | 50 | params = dict(attrs) 51 | if params.get('class') == 'table2': 52 | self.findTable = True 53 | 54 | if tag == self.TR and self.findTable and (params.get('bgcolor') == '#F4F4F4' or params.get('bgcolor') == '#FFFFFF'): # noqa 55 | self.inside_tr = True 56 | self.current_item = {} 57 | if not self.inside_tr: 58 | return 59 | 60 | if self.inside_tr and tag == self.TD: 61 | if "class" in params: 62 | self.item_name = self.parser_class.get(params["class"], None) 63 | if self.item_name: 64 | self.current_item[self.item_name] = -1 65 | 66 | if self.inside_tr and tag == self.A and self.HREF in params: 67 | link = params["href"] 68 | if link.startswith("http://itorrents.org/torrent/"): 69 | self.current_item["engine_url"] = self.url 70 | self.item_name = "name" 71 | elif link.endswith(".html"): 72 | try: 73 | safe_link = quote(self.url + link, safe='/:') 74 | except KeyError: 75 | safe_link = self.url + link 76 | self.current_item["link"] = safe_link 77 | self.current_item["desc_link"] = safe_link 78 | 79 | def handle_data(self, data): 80 | if self.inside_tr and self.item_name: 81 | if self.item_name == 'size' and (data.endswith('MB') or data.endswith('GB')): 82 | self.current_item[self.item_name] = data.strip().replace(',', '') 83 | elif not self.item_name == 'size': 84 | self.current_item[self.item_name] = data.strip().replace(',', '') 85 | 86 | self.item_name = None 87 | 88 | def handle_endtag(self, tag): 89 | if tag == 'table': 90 | self.findTable = False 91 | 92 | if self.inside_tr and tag == self.TR: 93 | self.inside_tr = False 94 | self.item_name = None 95 | array_length = len(self.current_item) 96 | if array_length < 1: 97 | return 98 | prettyPrinter(self.current_item) 99 | self.current_item = {} 100 | 101 | def download_torrent(self, info): 102 | # since limetorrents provides torrent links in itorrent (cloudflare protected), 103 | # we have to fetch the info page and extract the magnet link 104 | info_page = retrieve_url(info) 105 | magnet_match = re.search(r"href\s*\=\s*\"(magnet[^\"]+)\"", info_page) 106 | if magnet_match and magnet_match.groups(): 107 | print(magnet_match.groups()[0] + " " + info) 108 | else: 109 | raise Exception('Error, please fill a bug report!') 110 | 111 | def search(self, query, cat='all'): 112 | """ Performs search """ 113 | query = query.replace("%20", "-") 114 | category = self.supported_categories[cat] 115 | 116 | parser = self.MyHtmlParser(self.url) 117 | page = 1 118 | while True: 119 | page_url = "{0}/search/{1}/{2}/seeds/{3}/".format(self.url, category, query, page) 120 | html = retrieve_url(page_url) 121 | lunghezza_html = len(html) 122 | if page > 6 or lunghezza_html <= parser.page_empty: 123 | return 124 | parser.feed(html) 125 | page += 1 126 | parser.close() 127 | -------------------------------------------------------------------------------- /nova3/engines/piratebay.py: -------------------------------------------------------------------------------- 1 | #VERSION: 3.2 2 | # AUTHORS: Fabien Devaux (fab@gnux.info) 3 | # CONTRIBUTORS: Christophe Dumez (chris@qbittorrent.org) 4 | # Arthur (custparasite@gmx.se) 5 | # Diego de las Heras (ngosang@hotmail.es) 6 | 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the author nor the names of its contributors may be 16 | # used to endorse or promote products derived from this software without 17 | # specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | import json 32 | from urllib.parse import urlencode, unquote 33 | 34 | from novaprinter import prettyPrinter 35 | from helpers import retrieve_url 36 | 37 | 38 | class piratebay(object): 39 | url = 'https://thepiratebay.org' 40 | name = 'The Pirate Bay' 41 | supported_categories = { 42 | 'all': '0', 43 | 'music': '100', 44 | 'movies': '200', 45 | 'games': '400', 46 | 'software': '300' 47 | } 48 | 49 | # initialize trackers for magnet links 50 | trackers_list = [ 51 | 'udp://tracker.internetwarriors.net:1337/announce', 52 | 'udp://tracker.opentrackr.org:1337/announce', 53 | 'udp://p4p.arenabg.ch:1337/announce', 54 | 'udp://tracker.openbittorrent.com:6969/announce', 55 | 'udp://www.torrent.eu.org:451/announce', 56 | 'udp://tracker.torrent.eu.org:451/announce', 57 | 'udp://retracker.lanta-net.ru:2710/announce', 58 | 'udp://open.stealth.si:80/announce', 59 | 'udp://exodus.desync.com:6969/announce', 60 | 'udp://tracker.tiny-vps.com:6969/announce' 61 | ] 62 | trackers = '&'.join(urlencode({'tr': tracker}) for tracker in trackers_list) 63 | 64 | def search(self, what, cat='all'): 65 | base_url = "https://apibay.org/q.php?%s" 66 | 67 | # get response json 68 | what = unquote(what) 69 | category = self.supported_categories[cat] 70 | params = {'q': what} 71 | if category != '0': 72 | params['cat'] = category 73 | response = retrieve_url(base_url % urlencode(params)) 74 | response_json = json.loads(response) 75 | 76 | # check empty response 77 | if len(response_json) == 0: 78 | return 79 | 80 | # parse results 81 | for result in response_json: 82 | if result['info_hash'] == '0000000000000000000000000000000000000000': 83 | continue 84 | res = { 85 | 'link': self.download_link(result), 86 | 'name': result['name'], 87 | 'size': str(result['size']) + " B", 88 | 'seeds': result['seeders'], 89 | 'leech': result['leechers'], 90 | 'engine_url': self.url, 91 | 'desc_link': self.url + '/description.php?id=' + result['id'] 92 | } 93 | prettyPrinter(res) 94 | 95 | def download_link(self, result): 96 | return "magnet:?xt=urn:btih:{}&{}&{}".format( 97 | result['info_hash'], urlencode({'dn': result['name']}), self.trackers) 98 | -------------------------------------------------------------------------------- /nova3/engines/rarbg.py: -------------------------------------------------------------------------------- 1 | #VERSION: 2.14 2 | # AUTHORS: b0nk 3 | # CONTRIBUTORS: Diego de las Heras (ngosang@hotmail.es) 4 | 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the author nor the names of its contributors may be 14 | # used to endorse or promote products derived from this software without 15 | # specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | 29 | import json 30 | import time 31 | from urllib.parse import urlencode, unquote 32 | 33 | from novaprinter import prettyPrinter 34 | from helpers import retrieve_url 35 | 36 | 37 | class rarbg(object): 38 | url = 'https://rarbg.to' 39 | name = 'RARBG' 40 | supported_categories = { 41 | 'all': '4;14;17;18;23;25;27;28;32;33;40;41;42;44;45;46;47;48;49;50;51;52;53;54', 42 | 'movies': '14;17;42;44;45;46;47;48;50;51;52;54', 43 | 'tv': '18;41;49', 44 | 'music': '23;25', 45 | 'games': '27;28;32;40;53', 46 | 'software': '33' 47 | } 48 | 49 | def search(self, what, cat='all'): 50 | base_url = "https://torrentapi.org/pubapi_v2.php?%s" 51 | app_id = "qbittorrent" 52 | 53 | # get token 54 | params = urlencode({'get_token': 'get_token', 'app_id': app_id}) 55 | response = retrieve_url(base_url % params) 56 | j = json.loads(response) 57 | token = j['token'] 58 | time.sleep(2.1) 59 | 60 | # get response json 61 | what = unquote(what) 62 | category = self.supported_categories[cat] 63 | params = urlencode({'mode': 'search', 64 | 'search_string': what, 65 | 'ranked': 0, 66 | 'category': category, 67 | 'limit': 100, 68 | 'sort': 'seeders', 69 | 'format': 'json_extended', 70 | 'token': token, 71 | 'app_id': 'qbittorrent'}) 72 | response = retrieve_url(base_url % params) 73 | j = json.loads(response) 74 | 75 | # check empty response 76 | if 'torrent_results' not in j: 77 | return 78 | 79 | # parse results 80 | for result in j['torrent_results']: 81 | res = {'link': result['download'], 82 | 'name': result['title'], 83 | 'size': str(result['size']) + " B", 84 | 'seeds': result['seeders'], 85 | 'leech': result['leechers'], 86 | 'engine_url': self.url, 87 | 'desc_link': result['info_page'] + "&app_id=" + app_id} 88 | prettyPrinter(res) 89 | -------------------------------------------------------------------------------- /nova3/engines/solidtorrents.py: -------------------------------------------------------------------------------- 1 | # VERSION: 2.1 2 | # AUTHORS: nKlido 3 | 4 | # LICENSING INFORMATION 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | from helpers import retrieve_url 24 | from novaprinter import prettyPrinter 25 | from html.parser import HTMLParser 26 | import math 27 | 28 | 29 | class solidtorrents(object): 30 | url = 'https://solidtorrents.net' 31 | name = 'Solid Torrents' 32 | supported_categories = {'all': 'all', 'music': 'Audio', 'books': 'eBook'} 33 | 34 | class TorrentInfoParser(HTMLParser): 35 | 36 | def __init__(self, url): 37 | HTMLParser.__init__(self) 38 | self.url = url 39 | self.foundResult = False 40 | self.foundTitle = False 41 | self.parseTitle = False 42 | self.foundStats = False 43 | self.parseSeeders = False 44 | self.parseLeechers = False 45 | self.parseSize = False 46 | self.column = 0 47 | self.torrentReady = False 48 | self.foundSearchStats = False 49 | self.parseTotalResults = False 50 | self.totalResults = 0 51 | 52 | self.torrent_info = self.empty_torrent_info() 53 | 54 | def empty_torrent_info(self): 55 | return { 56 | 'link': '', 57 | 'name': '', 58 | 'size': '-1', 59 | 'seeds': '-1', 60 | 'leech': '-1', 61 | 'engine_url': self.url, 62 | 'desc_link': '' 63 | } 64 | 65 | def handle_starttag(self, tag, attrs): 66 | params = dict(attrs) 67 | 68 | if 'search-stats' in params.get('class', ''): 69 | self.foundSearchStats = True 70 | 71 | if (self.foundSearchStats and tag == 'b'): 72 | self.parseTotalResults = True 73 | self.foundSearchStats = False 74 | 75 | if 'search-result' in params.get('class', ''): 76 | self.foundResult = True 77 | return 78 | 79 | if (self.foundResult and 'title' in params.get('class', '') and tag == 'h5'): 80 | self.foundTitle = True 81 | 82 | if (self.foundTitle and tag == 'a'): 83 | self.torrent_info['desc_link'] = self.url + params.get('href') 84 | self.parseTitle = True 85 | 86 | if (self.foundResult and 'stats' in params.get('class', '')): 87 | self.foundStats = True 88 | self.column = -1 89 | 90 | if (self.foundStats and tag == 'div'): 91 | self.column = self.column + 1 92 | 93 | if (self.column == 2): 94 | self.parseSize = True 95 | 96 | if (self.foundStats and tag == 'font' and self.column == 3): 97 | self.parseSeeders = True 98 | 99 | if (self.foundStats and tag == 'font' and self.column == 4): 100 | self.parseLeechers = True 101 | 102 | if (self.foundResult and 'dl-magnet' in params.get('class', '') and tag == 'a'): 103 | self.torrent_info['link'] = params.get('href') 104 | self.foundResult = False 105 | self.torrentReady = True 106 | 107 | def handle_endtag(self, tag): 108 | if (self.torrentReady): 109 | prettyPrinter(self.torrent_info) 110 | self.torrentReady = False 111 | self.torrent_info = self.empty_torrent_info() 112 | 113 | def handle_data(self, data): 114 | 115 | if (self.parseTotalResults): 116 | self.totalResults = int(data.strip()) 117 | self.parseTotalResults = False 118 | 119 | if (self.parseTitle): 120 | if (bool(data.strip()) and data != '\n'): 121 | self.torrent_info['name'] = data 122 | self.parseTitle = False 123 | self.foundTitle = False 124 | 125 | if (self.parseSize): 126 | self.torrent_info['size'] = data 127 | self.parseSize = False 128 | 129 | if (self.parseSeeders): 130 | self.torrent_info['seeds'] = data 131 | self.parseSeeders = False 132 | 133 | if (self.parseLeechers): 134 | self.torrent_info['leech'] = data 135 | self.parseLeechers = False 136 | self.foundStats = False 137 | 138 | def request(self, searchTerm, category, page=1): 139 | return retrieve_url( 140 | self.url + '/search?q=' + searchTerm + '&category=' + category 141 | + '&sort=seeders&sort=desc&page=' + str(page)) 142 | 143 | def search(self, what, cat='all'): 144 | category = self.supported_categories[cat] 145 | 146 | parser = self.TorrentInfoParser(self.url) 147 | parser.feed(self.request(what, category, 1)) 148 | 149 | totalPages = min(math.ceil(parser.totalResults / 20), 5) 150 | 151 | for page in range(2, totalPages + 1): 152 | parser.feed(self.request(what, category, page)) 153 | 154 | parser.close() 155 | -------------------------------------------------------------------------------- /nova3/engines/torlock.py: -------------------------------------------------------------------------------- 1 | #VERSION: 2.22 2 | # AUTHORS: Douman (custparasite@gmx.se) 3 | # CONTRIBUTORS: Diego de las Heras (ngosang@hotmail.es) 4 | 5 | from re import compile as re_compile 6 | from html.parser import HTMLParser 7 | 8 | from novaprinter import prettyPrinter 9 | from helpers import retrieve_url, download_file 10 | 11 | 12 | class torlock(object): 13 | url = "https://www.torlock2.com" 14 | name = "TorLock" 15 | supported_categories = {'all': 'all', 16 | 'anime': 'anime', 17 | 'software': 'software', 18 | 'games': 'game', 19 | 'movies': 'movie', 20 | 'music': 'music', 21 | 'tv': 'television', 22 | 'books': 'ebooks'} 23 | 24 | def download_torrent(self, info): 25 | print(download_file(info)) 26 | 27 | class MyHtmlParser(HTMLParser): 28 | """ Sub-class for parsing results """ 29 | def __init__(self, url): 30 | HTMLParser.__init__(self) 31 | self.url = url 32 | self.article_found = False # true when
with results is found 33 | self.item_found = False 34 | self.item_bad = False # set to True for malicious links 35 | self.current_item = None # dict for found item 36 | self.item_name = None # key's name in current_item dict 37 | self.parser_class = {"ts": "size", 38 | "tul": "seeds", 39 | "tdl": "leech"} 40 | 41 | def handle_starttag(self, tag, attrs): 42 | params = dict(attrs) 43 | if self.item_found: 44 | if tag == "td": 45 | if "class" in params: 46 | self.item_name = self.parser_class.get(params["class"], None) 47 | if self.item_name: 48 | self.current_item[self.item_name] = "" 49 | 50 | elif self.article_found and tag == "a": 51 | if "href" in params: 52 | link = params["href"] 53 | if link.startswith("/torrent"): 54 | self.current_item["desc_link"] = "".join((self.url, link)) 55 | self.current_item["link"] = "".join((self.url, "/tor/", 56 | link.split('/')[2], ".torrent")) 57 | self.current_item["engine_url"] = self.url 58 | self.item_found = True 59 | self.item_name = "name" 60 | self.current_item["name"] = "" 61 | self.item_bad = "rel" in params and params["rel"] == "nofollow" 62 | 63 | elif tag == "article": 64 | self.article_found = True 65 | self.current_item = {} 66 | 67 | def handle_data(self, data): 68 | if self.item_name: 69 | self.current_item[self.item_name] += data 70 | 71 | def handle_endtag(self, tag): 72 | if tag == "article": 73 | self.article_found = False 74 | elif self.item_name and (tag == "a" or tag == "td"): 75 | self.item_name = None 76 | elif self.item_found and tag == "tr": 77 | self.item_found = False 78 | if not self.item_bad: 79 | prettyPrinter(self.current_item) 80 | self.current_item = {} 81 | 82 | def search(self, query, cat='all'): 83 | """ Performs search """ 84 | query = query.replace("%20", "-") 85 | 86 | parser = self.MyHtmlParser(self.url) 87 | page = "".join((self.url, "/", self.supported_categories[cat], 88 | "/torrents/", query, ".html?sort=seeds&page=1")) 89 | html = retrieve_url(page) 90 | parser.feed(html) 91 | 92 | counter = 1 93 | additional_pages = re_compile(r"/{0}/torrents/{1}.html\?sort=seeds&page=[0-9]+" 94 | .format(self.supported_categories[cat], query)) 95 | list_searches = additional_pages.findall(html)[:-1] # last link is next(i.e. second) 96 | for page in map(lambda link: "".join((self.url, link)), list_searches): 97 | html = retrieve_url(page) 98 | parser.feed(html) 99 | counter += 1 100 | if counter > 3: 101 | break 102 | parser.close() 103 | -------------------------------------------------------------------------------- /nova3/engines/torrentproject.py: -------------------------------------------------------------------------------- 1 | #VERSION: 1.2 2 | #AUTHORS: mauricci 3 | 4 | from helpers import retrieve_url 5 | from novaprinter import prettyPrinter 6 | import re 7 | 8 | from html.parser import HTMLParser 9 | from urllib.parse import unquote 10 | 11 | 12 | class torrentproject(object): 13 | url = 'https://torrentproject2.se' 14 | name = 'TorrentProject' 15 | supported_categories = {'all': '0'} 16 | 17 | class MyHTMLParser(HTMLParser): 18 | 19 | def __init__(self, url): 20 | HTMLParser.__init__(self) 21 | self.url = url 22 | self.insideResults = False 23 | self.insideDataDiv = False 24 | self.pageComplete = False 25 | self.spanCount = -1 26 | self.infoMap = {'name': 0, 'torrLink': 0, 'size': 5, 'seeds': 2, 'leech': 3} 27 | self.fullResData = [] 28 | self.pageRes = [] 29 | self.singleResData = self.get_single_data() 30 | 31 | def get_single_data(self): 32 | return { 33 | 'name': '-1', 34 | 'seeds': '-1', 35 | 'leech': '-1', 36 | 'size': '-1', 37 | 'link': '-1', 38 | 'desc_link': '-1', 39 | 'engine_url': self.url 40 | } 41 | 42 | def handle_starttag(self, tag, attrs): 43 | attributes = dict(attrs) 44 | if tag == 'div' and 'nav' in attributes.get('id', ''): 45 | self.pageComplete = True 46 | if tag == 'div' and attributes.get('id', '') == 'similarfiles': 47 | self.insideResults = True 48 | if tag == 'div' and self.insideResults and 'gac_bb' not in attributes.get('class', ''): 49 | self.insideDataDiv = True 50 | elif tag == 'span' and self.insideDataDiv and 'verified' != attributes.get('title', ''): 51 | self.spanCount += 1 52 | if self.insideDataDiv and tag == 'a' and len(attrs) > 0: 53 | if self.infoMap['torrLink'] == self.spanCount and 'href' in attributes: 54 | self.singleResData['link'] = self.url + attributes['href'] 55 | if self.infoMap['name'] == self.spanCount and 'href' in attributes: 56 | self.singleResData['desc_link'] = self.url + attributes['href'] 57 | 58 | def handle_endtag(self, tag): 59 | if not self.pageComplete: 60 | if tag == 'div': 61 | self.insideDataDiv = False 62 | self.spanCount = -1 63 | if len(self.singleResData) > 0: 64 | # ignore trash stuff 65 | if self.singleResData['name'] != '-1' \ 66 | and self.singleResData['size'] != '-1' \ 67 | and self.singleResData['name'].lower() != 'nome': 68 | # ignore those with link and desc_link equals to -1 69 | if self.singleResData['desc_link'] != '-1' \ 70 | or self.singleResData['link'] != '-1': 71 | try: 72 | prettyPrinter(self.singleResData) 73 | except Exception: 74 | print(self.singleResData) 75 | self.pageRes.append(self.singleResData) 76 | self.fullResData.append(self.singleResData) 77 | self.singleResData = self.get_single_data() 78 | 79 | def handle_data(self, data): 80 | if self.insideDataDiv: 81 | for key, val in self.infoMap.items(): 82 | if self.spanCount == val: 83 | curr_key = key 84 | if curr_key in self.singleResData and data.strip() != '': 85 | if self.singleResData[curr_key] == '-1': 86 | self.singleResData[curr_key] = data.strip() 87 | elif curr_key != 'name': 88 | self.singleResData[curr_key] += data.strip() 89 | 90 | def feed(self, html): 91 | HTMLParser.feed(self, html) 92 | self.pageComplete = False 93 | self.insideResults = False 94 | self.insideDataDiv = False 95 | self.spanCount = -1 96 | 97 | def search(self, what, cat='all'): 98 | # curr_cat = self.supported_categories[cat] 99 | parser = self.MyHTMLParser(self.url) 100 | what = what.replace('%20', '+') 101 | # analyze first 5 pages of results 102 | for currPage in range(0, 5): 103 | url = self.url + '?t={0}&p={1}'.format(what, currPage) 104 | html = retrieve_url(url) 105 | parser.feed(html) 106 | if len(parser.pageRes) <= 0: 107 | break 108 | del parser.pageRes[:] 109 | parser.close() 110 | 111 | def download_torrent(self, info): 112 | """ Downloader """ 113 | html = retrieve_url(info) 114 | m = re.search('href=[\'\"].*?(magnet.+?)[\'\"]', html) 115 | if m and len(m.groups()) > 0: 116 | magnet = unquote(m.group(1)) 117 | print(magnet + ' ' + info) 118 | -------------------------------------------------------------------------------- /nova3/engines/torrentscsv.py: -------------------------------------------------------------------------------- 1 | #VERSION: 1.2 2 | # AUTHORS: Dessalines 3 | 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # * Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the author nor the names of its contributors may be 13 | # used to endorse or promote products derived from this software without 14 | # specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | import json 29 | from urllib.parse import urlencode 30 | 31 | from novaprinter import prettyPrinter 32 | from helpers import retrieve_url 33 | 34 | 35 | class torrentscsv(object): 36 | url = 'https://torrents-csv.ml' 37 | name = 'torrents-csv' 38 | supported_categories = {'all': ''} 39 | 40 | # initialize trackers for magnet links 41 | trackers_list = [ 42 | 'udp://tracker.internetwarriors.net:1337/announce', 43 | 'udp://tracker.opentrackr.org:1337/announce', 44 | 'udp://p4p.arenabg.ch:1337/announce', 45 | 'udp://tracker.openbittorrent.com:6969/announce', 46 | 'udp://www.torrent.eu.org:451/announce', 47 | 'udp://tracker.torrent.eu.org:451/announce', 48 | 'udp://retracker.lanta-net.ru:2710/announce', 49 | 'udp://open.stealth.si:80/announce', 50 | 'udp://exodus.desync.com:6969/announce', 51 | 'udp://tracker.tiny-vps.com:6969/announce' 52 | ] 53 | trackers = '&'.join(urlencode({'tr': tracker}) for tracker in trackers_list) 54 | 55 | def search(self, what, cat='all'): 56 | search_url = "{}/service/search?size=300&q={}".format(self.url, what) 57 | desc_url = "{}/#/search/torrent/{}/1".format(self.url, what) 58 | 59 | # get response json 60 | response = retrieve_url(search_url) 61 | response_json = json.loads(response) 62 | 63 | # parse results 64 | for result in response_json: 65 | res = {'link': self.download_link(result), 66 | 'name': result['name'], 67 | 'size': str(result['size_bytes']) + " B", 68 | 'seeds': result['seeders'], 69 | 'leech': result['leechers'], 70 | 'engine_url': self.url, 71 | 'desc_link': desc_url} 72 | prettyPrinter(res) 73 | 74 | def download_link(self, result): 75 | return "magnet:?xt=urn:btih:{}&{}&{}".format( 76 | result['infohash'], urlencode({'dn': result['name']}), self.trackers) 77 | -------------------------------------------------------------------------------- /nova3/engines/versions.txt: -------------------------------------------------------------------------------- 1 | eztv: 1.14 2 | jackett: 4.0 3 | limetorrents: 4.7 4 | piratebay: 3.2 5 | rarbg: 2.14 6 | solidtorrents: 2.1 7 | torlock: 2.22 8 | torrentproject: 1.2 9 | torrentscsv: 1.2 10 | --------------------------------------------------------------------------------