i96751414 / script.flix.magneto

Provider for Flix, using Torrest
4 stars 1 forks source link

[Support] How do I install and use this addon? #11

Open pitsi opened 6 months ago

pitsi commented 6 months ago

Hello everyone and happy holidays :)

I learned about torrest a few months ago, but I decided to test it yesterday that I had some free time. So, I installed the repo and torrest via the repo. But since torrest only works with magnet/torrent links, which means I had to paste a url at it, I installed flix from the repo so as to be able to browse for movies and series, because all it does is scrapping tmdb. Selecting anything from there returns a "no providers found" message, which brings us to this addon.

Since v17, kodi hides all script.* addons from its menus. Some of them may appear when a search is made, but in general they are all hidden. This means that the addon is not "available" on the repo if someone wants to find it the manual way: (install from repo > select it > locate it under a category. In turn, the repo itself is "virtual" (as mentioned in the readme), so there is no way to check if the addon is actually there. I have tried opening http://127.0.0.1:{port}/addons.xml (with curl) but no luck. Maybe the port I used there is wrong. So, I resorted to downloading the entire github repo as a zip and manually installing that one zip!

But it still does not work. Instead of "no providers found" flix now returns "no results found" and this comes up in the log. IOError: [Errno 2] No such file or directory: u'/storage/.kodi/addons/script.flix.magneto/resources/providers.json' The mentioned file is indeed missing, so is there something extra that the user has to do in order to make it work?

i96751414 commented 6 months ago

Hello pitsi - happy holidays!

You are almost there actually. Let me try to summarise things first and explain afterwards.

repository.github - This is my repository. It is virtually as you said and the main reason behind that is that some addons are platform dependant (like plugin.video.torrest). Being a virtual repository, i.e. managed through software, this repository helps in installing the correct version for the given platform. You can see the list of addons that are included in this repository here.

plugin.video.flix - This is a tmdb scrapper with a particularity - It supports the so called providers which are essentially external plugins/add-ons that implement the Flix Provider API making it possible to play the media listed by Flix. script.flix.dummy is a dummy implementation of the Provider API I created just to test the providers integration - it doesn't do anything special other than playing Big Buck Bunny. The other addon which implements the Provider API is script.flix.magnet - but we will address this one later.

plugin.video.torrest - This is a torrent manager and streaming engine for Kodi. It also exposes an API which can be used by external addons for reproducing torrents, etc.

Before moving on, let me add the note that these addons are available in the virtual repository and they are completely legal. Furthermore, I don't intend to distribute any illegal addons/plugins.

script.flix.magneto - This is the addon that connects Flix with Torrest, that is, it implements the Flix Provider API and also uses the Torrest API to reproduce torrents. It is important to note that this is also an implementation of an abstract scraper which is intended to work against as many sites as possible; however, the scrapping definitions must be created by the user and placed in script.flix.magneto/resources/providers.json. This is the reason why this addon is not available in the virtual repository and needs to be manually installed.

What would be the next steps: You will have to update the addon settings and also create your own providers.json. This is much simpler than it looks - the main goal of this addon is exactly to simplify this whole process. I suggest you to read the README of the project and play around with the provider_test tool which was created for aiding the providers definition. You can also have a look at issues #1 and #2, that were opened by users who had to create their providers definition.

Hope this helps!

pitsi commented 6 months ago

I am out of luck then. My python skills are of... elementary school and rarbg's torrentapi was shut down 6+ months ago.

i96751414 commented 6 months ago

You don't need Python at all - the provider definition is basically a JSON.

pitsi commented 6 months ago

I know. But I have to understand provider_test.py in order to make a proper json. Anyway, I will give it a shot when I have some time.

Can you please offer the addon as a zip from the releases page?

antonsoroko commented 4 months ago

@pitsi just out of curiosity i tried to make a provider: providers.json:

[
  {
    "name": "The Pirate Bay",
    "base_url": "https://thepiratebay10.org",
    "results_parser": {
      "url": "/search/{query:q}/1/99/200",
      "rows": ".//table/tr[@class]",
      "rows": ".//table/tr/td[2]/a[@href]/../..",
      "data": {
        "magnet": "td[2]/a/@href",
        "title": "td[2]/div/a/text()",
        "seeds": "td[3]/text()",
        "leeches": "td[4]/text()",
        "size": "td[2]/font/text()"
      },
      "mutate": {
        "size": "{size:replace('.*?Size (.+?),.*', '\\\\1')}"
      }
    },
    "keywords": {
      "movie": "{title} {year}",
      "show": "{title}",
      "season": "{title} S{season:02}",
      "episode": "{title} S{season:02}E{episode:02}"
    },
    "attributes": {
      "color": "FFF14E13",
      "icon": "provider_icons/thepiratebay.png"
    }
  }
]

and for settings.xml: <setting id="the.pirate.bay" type="bool" label="The Pirate Bay" default="true"/>

~it semi-works (it gets only half of results, because of #12 ).~ it works and you can use this as example to add more providers. use https://www.w3schools.com/xml/xpath_syntax.asp as documentation, for example. (although standard python library that is used here for xpath does not support some things like position() but it is not critical).

P.S. to install addon you can simply click green button "Code" -> "Download ZIP" on the main page of repo.

antonsoroko commented 4 months ago

@i96751414 just to share my thoughts: i believe that without pre-defined providers.json users will not use your addons. to create providers.json person should know html, xpath and json - so at very least a person should have some web developing background. this can explain low number of stars on github and 0 mentions about addons on sites like reddit.

your projects looks interesting, but w/o out-of-the-box way to use them - they kind of private only to you.

best wishes.

i96751414 commented 4 months ago

Hi Anton,

Thanks for your feedback. I do like to contribute to the open-source community and I will keep doing so, however I would like to refrain from providing possibly illegal content (it may sound a cliché, but it's genuine). Maybe I will have to think on a different strategy to support more people.

antonsoroko commented 4 months ago

@i96751414 hi. i do understand your concern :-) maybe you can use some kind of forum where people can share their json code. (after all - it is just a distributing of a json code - not distributing come copyrighted content. but this is IMHO, of course.)

icarok99 commented 4 months ago

@antonsoroko Do Brazilian providers work?

antonsoroko commented 4 months ago

@icarok99 do you mean those "fake" torrent trackers? i guess you can make them work by using https://github.com/i96751414/script.flix.magneto?tab=readme-ov-file#using-an-additional-parser

so "torrent_url": "td[1]/a[2]/@href", will point to sub page, and then "magnet": .//main/div/ul/li/a/@href" will find magnet link. i think magneto supports only 1 magnet link per sub page (like burst) - so if sub page has many magnet links (like on some of yours screenshots) - then you need to specify path to first or best link.

but i have not tried this - so you need to try and share feedback with i96751414.

i96751414 commented 4 months ago

I just created a new issue (#15) so eventually this plugin supports parsing results from multiple pages. It shouldn't be hard to implement such feature.

addon-rajada commented 4 months ago

Hi, i tried to do some providers using xpath syntax. It works great, except for Brazilian sites (nothing new under the sun). Even with additional_parsers results are not very good.

Here is two providers i did:

[
        {
        "name": "BitSearch", "base_url": "https://bitsearch.to",
        "results_parser": {
          "url": "/search?q={query:q}&category=1&subcat=2&sort=seeders",
          "rows": ".//div[@class='w3-col s12 mt-1']/li/div/div/../..",
          "data": {
            "magnet": "div[2]/a[2]/@href",
            "title": "div[1]/div/h5/a/text()",
            "seeds": "div[1]/div/div/div/div[3]/font/text()",
            "leeches": "div[1]/div/div/div/div[4]/font/text()",
            "size": "div[1]/div/div/div/div[2]/text()"
          }
        },
        "keywords": { "movie": "{title} {year}", "show": "{title}", "season": "{title} S{season:02}", "episode": "{title} S{season:02}E{episode:02}" },
        "attributes": { "color": "FF6AC045", "icon": "provider_icons/default.png"}
    },

    {
        "name": "Insanos Torrent", "base_url": "https://insanostorrent.com",
        "results_parser": {
            "url": "/?s={query:q}", "type": "html",
            "rows": ".//div[@class='mblock-content']/div[@class='box-filme-item']/div[1]/div[@class='filme-rating']/div/span/../../..",
            "data": {
              "torrent_url": "a[1]/@href",
              "title": "div[3]/img/@alt"
            }
            },
        "additional_parsers": [
            {
              "url": "{torrent_url}", "type": "html",
              "data": {
                "magnet": ".//div[@class='items']/div[@id='categoria']/div[@class='row row-single']/div/input[@type='button']/@value"
              }
            }
        ],
        "keywords": { "movie": "{title} {year}", "show": "{title}", "season": "{title} S{season:02}", "episode": "{title} S{season:02}E{episode:02}" },
        "attributes": { "color": "FFF25F2A", "icon": "provider_icons/default.png" }
    }
]

Besides that, i just found a way to port elementum providers to Flix. As it works at Rajada, it will likely work with Burst. You can check it here.

The Rajada and Flix dialogs are running concurrently. I've increase flix timeout to 50 seconds. By now flix_main.py is converting flix requests to elementum general query search payload, but it can be enhanced.

i96751414 commented 4 months ago

Can you provide an example that doesn't work very well?

icarok99 commented 4 months ago

Can you provide an example that doesn't work very well?

Insanos Torrent

Screenshot_2024-02-20-20-43-42-324_com android chrome

Screenshot_2024-02-20-20-50-57-607_org xbmc kodi

i96751414 commented 4 months ago

For the sake of curiosity, the updated Insanos provider is as shown below. This is only supported since 3f3b727.

[
  {
    "name": "Insanos Torrent",
    "base_url": "https://insanostorrent.com",
    "results_parser": {
      "url": "/?s={query:q}",
      "type": "html",
      "rows": ".//div[@class='mblock-content']/div[@class='box-filme-item']/div[1]/div[@class='filme-rating']/div/span/../../..",
      "data": {
        "torrent_url": "a[1]/@href",
        "title": "div[3]/img/@alt"
      }
    },
    "additional_parsers": [
      {
        "url": "{torrent_url}",
        "type": "html",
        "rows": ".//div[@class='items']/div[@id='categoria']/div[@class='row row-single']/div",
        "data": {
          "magnet": "input[@type='button']/@value",
          "type": "b/a/text()"
        },
        "mutate": {
          "title": "{title} [{type}]"
        }
      }
    ],
    "keywords": {
      "movie": "{title} {year}",
      "show": "{title}",
      "season": "{title} S{season:02}",
      "episode": "{title} S{season:02}E{episode:02}"
    },
    "attributes": {
      "color": "FFF25F2A",
      "icon": "provider_icons/default.png"
    }
  }
]
icarok99 commented 3 months ago

@i96751414 just to share my thoughts: i believe that without pre-defined providers.json users will not use your addons. to create providers.json person should know html, xpath and json - so at very least a person should have some web developing background. this can explain low number of stars on github and 0 mentions about addons on sites like reddit.

your projects looks interesting, but w/o out-of-the-box way to use them - they kind of private only to you.

best wishes.

Yes, I even gave up after a few attempts.

antonsoroko commented 3 months ago

@i96751414 In case if you do not want to keep json file in git repo, some Kodi addons (like tmdb helper) do this: They have "import from url" functionality and then users use short URLs to share their files. This is still not out-of-the-box solution, but much better solution than manual file creation.