Closed vijayvcm closed 2 months ago
Nice work. Can you make some changes
/resources/yaml/
/{secret_str}/catalog/{catalog_type}/{catalog_id}/search={search_query}.json
searchFor information on our supported api endpoint you can check the swagger ui https://mediafusion.elfhosted.com/docs
Currently, it supports only Direct Torrents. Not sure it will work if it is configured with any debrid services. Maybe we can improve it from here.
Looks like the torrentio prowlarr scraper is able to take in the debrid key https://github.com/dreulavelle/Prowlarr-Indexers/blob/main/Custom/torrentio.yml#L36
Even though its try to setup debrid key, its not used as it is. only prowlarr support infohash and magnet link isnt it?
i could see in that template its only setting info hash. https://github.com/dreulavelle/Prowlarr-Indexers/blob/a1e7568ec97ee8e10a4fc05240d3a038b058a854/Custom/torrentio.yml#L109
if the prowlarr support setting direct medialink then its fine to use debrid configured url mediafusion. otherwise you can just use the configured url without that.
Apart from this, you can generate the magnet link as below https://github.com/mhdzumair/MediaFusion/blob/0809a0155ecad654909dd0f8a5f54985eeb32258/kodi/plugin.video.mediafusion/lib/router.py#L267-L269 https://github.com/mhdzumair/MediaFusion/blob/0809a0155ecad654909dd0f8a5f54985eeb32258/kodi/plugin.video.mediafusion/lib/utils.py#L97-L105
I could not find any example that uses two queries to get the streams. Probably, we can have an endpoint that combines both search and streams logic which will reduce the complexity in the yaml file.
I can easily set up an endpoint, but I'm afraid this will make huge impact on elfhosted infrastructure even though they have ratelimits.
Today mediafusion elfhosted faced downtime due to high number of internal scraping. They have only rate limit for public access. They recently set up an indexer for their another application name "riven" its internally scraping through mediafusion api. Therefore, until riven figure out slow scraping rather than aggressively. We enabled mediafusion in-built rate limit scraping.
if in-built ratelimit enabled, it will hugely reduce the bots scraping. including this prowlarr indexer. So, our current ratelimit criteria as below.
General API limit: 50 / 1 min
Catalog endpoint: 150 / 5 min
Stream endpoint: 10 / 1 hour
(This mean you can open 10 movies/series/live tv per 1 hour. )
Streaming provider endpoint and poster endpoints are exclude from rate limitation since its a real user's usage endpoints.
Hii @vijayvcm any updates? I'm in favor to create a new API endpoint for searching based on title and provide torrents detail. You might need to create API endpoint as well as crud function with mongo aggregation pipeline, check the search_meta
endpoint function in api/main.py
and the process_search_query
function in db/crud.py
Hi @mhdzumair
Sorry for the delay. Unfortunately, I could not spend much time on this. I am working as a full-time developer and I hardly get time to work on my personal projects.
Probably I will continue it in the coming weekend. Until then I would be happy if anybody could take the lead from here.
Yeah, no pressure.
@vijayvcm @mhdzumair I tested the below prowlarr yml, seems to work
---
id: mediafusion-elfhosted
name: MediaFusion - ElfHosted
description: "MediaFusion - ElfHosted Free Public Indexer"
language: en-US
type: public
encoding: UTF-8
followredirect: false
testlinktorrent: false
requestDelay: 2
links:
- https://mediafusion.elfhosted.com/
caps:
categories:
Movies: Movies
TV: TV
modes:
search: [q]
movie-search: [q, imdbid]
tv-search: [q, imdbid, season, ep]
allowrawsearch: false
settings:
- name: mediafusion_note
type: info
label: MediaFusion Note
default: "Please enter the mediafusion addon url below (manifest.json)"
- name: addon_url
type: text
label: Addon URL
default: ""
- name: validate_imdb_movie
type: text
label: IMDB ID of the movie for Radarr validation (required)
default: "tt0110357" # The Lion King
- name: validate_imdb_tv
type: text
label: IMDB ID of the TV show for Sonarr validation (required)
default: "tt11815682" # Hacks S1 E1
search:
headers:
User-Agent:
[
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0",
]
paths:
- path: "{{ if .Query.IMDBID }}stream/movie/{{ .Query.IMDBID }}.json{{ else }}stream/movie/{{ .Config.validate_imdb_movie }}.json{{ end }}"
method: get
response:
type: json
noResultsMessage: '"streams": []'
categories: [Movies]
- path: "{{ if .Query.IMDBID }}stream/series/{{ .Query.IMDBID }}{{ else }}stream/series/{{ .Config.validate_imdb_tv }}{{ end }}:{{ if .Query.Season }}{{ .Query.Season }}{{ else }}1{{ end }}:{{ if .Query.Ep }}{{ .Query.Ep }}{{ else }}1{{ end }}.json"
method: get
response:
type: json
noResultsMessage: '"streams": []'
categories: [TV]
rows:
selector: streams
missingAttributeEqualsNoResults: true
fields:
title:
selector: description
filters:
- name: split
args: ["\n", 0]
year:
selector: description
filters:
- name: regexp
args: "(\\b(19|20)\\d\\d\\b)"
category_is_tv_show:
text: "{{ .Result.title }}"
filters:
- name: regexp
args: "\\b(S\\d+(?:E\\d+)?)\\b"
category:
text: "{{ if .Result.category_is_tv_show }}TV{{ else }}Movies{{ end }}"
infohash:
selector: infoHash
size:
selector: description
filters:
- name: regexp
args: "\\b(\\d+(?:\\.\\d+)? [MG]B)\\b"
seeders:
selector: description
filters:
- name: regexp
args: "(?<=π€ )(\\d+)"
The update introduces the "MediaFusion - ElfHosted" public indexer via the mediafusion.yaml
configuration, enhancing media search capabilities for movies and TV shows. It incorporates structured metadata, dynamic API paths, and user input validation. Key features include detailed response parsing and robust error handling, ensuring an informative user experience when retrieving media content.
File Path | Change Summary |
---|---|
resources/yaml/mediafusion.yaml |
New file created for the "MediaFusion - ElfHosted" indexer, detailing metadata, search modes, user input settings, and response handling. |
README.md , resources/html/home.html |
Added support for the Prowlarr indexer in both files, improving integration with Radarr and Sonarr for enhanced media management. |
π° In fields of data, bright and new,
MediaFusion hops, with a view!
For movies and shows, it searches with grace,
Bringing treasures to every space.
With fields and paths, oh what a delight,
A joyful find, in day or night! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@ragmehos Your yaml works fine for me!
But you have not used the addon_url, which allows us to use a self-hosted mediafusion instance and gives filtered results based on the addon configuration.
I have modified the code a little bit (earlier it had a few issues). If the user configured the addon URL then it takes the addon URL as a prefix to {instance}/{secret_str}/stream/{type}/{id}.json
. Otherwise, it uses the default endpoint with the base URL which is an elfhosted instance {elfhosted}/stream/{type}/{id}.json
.
@mhdzumair Can you tell me on which scenarios we need mf* ids? I can almost get the IMDB ID of any movie/series with the tmdb API by using their findExternalId
API (even for Indian movies). I would suggest that we should stick with the public IDs as they don't change and will be easy to integrate/work with the other applications. Using our IDs will be difficult to maintain in the long run.
If the items with mf* id are less in count, then we can try to map those to the public IDs. Just my opinion.
The new changes improved the IMDB ID detection for TamilMV and TamilBlasters. So yeah, I agree that we could stick into IMDb ID search. Could you just add a reference into README doc? ill merge this MR afterwards. furthermore if you want you can add into home page as list item https://github.com/mhdzumair/MediaFusion/blob/f4ff80d6270421e6d4809f5d9367358d8342dd7f/resources/html/home.html#L77
@mhdzumair Updated the README.md and home.html
@vijayvcm thanks for your contribution.
Issue
216
Changes
NOTES
There are a few things that need improvement here
Summary by CodeRabbit