.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.moviepilot Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
list categories = ["movies"]
 
str base_url = "https://www.moviepilot.de"
 
str image_url = "https://assets.cdn.moviepilot.de/files/{image_id}/fill/155/223/{filename}"
 
list filter_types = ["fsk", "genre", "jahr", "jahrzehnt", "land", "online", "stimmung", "person"]
 

Detailed Description

Moviepilot is a German movie database, similar to IMDB or TMDB.  It doesn't
have any official API, but it uses JSON requests internally to fetch search
results and suggestions, that's being used in this implementation.

Moviepilot additionally allows to discover movies by certain categories
or filters, hence we provide the following syntax:

- Any normal search query -> Fetch search results by the query

- A query containing one of the category identifiers ``fsk``, ``genre``,
  ``jahr``, ``jahrzent``, ``land``, ``online``, ``stimmung`` will be used to
  search trending items by the provided filters, which are appended to the
  filter category after a ``-``.

Search examples:

- Normal: ``!mp Tom Cruise``
- By filter: ``!mp person-Ryan-Gosling``
- By filter: ``!mp fsk-0 land-deutschland genre-actionfilm``
- By filter: ``!mp jahrzehnt-2020er online-netflix``

For a list of all public filters, observe the url path when browsing

- https://www.moviepilot.de/filme/beste.

Function Documentation

◆ request()

searx.engines.moviepilot.request ( query,
params )

Definition at line 49 of file moviepilot.py.

49def request(query, params):
50 query_parts = query.split(" ")
51
52 discovery_filters = []
53 for query_part in query_parts:
54 filter_category_and_value = query_part.split("-", 1)
55
56 if len(filter_category_and_value) < 2:
57 continue
58
59 filter_category = filter_category_and_value[0]
60
61 if filter_category in filter_types:
62 discovery_filters.append(query_part)
63
64 params['discovery'] = len(discovery_filters) != 0
65
66 if params['discovery']:
67 args = {
68 'page': params['pageno'],
69 'order': 'beste',
70 }
71 params["url"] = f"{base_url}/api/discovery?{urlencode(args)}"
72 for discovery_filter in discovery_filters:
73 params["url"] += f"&filters[]={discovery_filter}"
74 else:
75 args = {
76 'q': query,
77 'page': params['pageno'],
78 'type': 'suggest',
79 }
80 params["url"] = f"{base_url}/api/search?{urlencode(args)}"
81
82 return params
83
84

◆ response()

searx.engines.moviepilot.response ( resp)

Definition at line 85 of file moviepilot.py.

85def response(resp):
86 results = []
87
88 json = resp.json()
89
90 json_results = []
91
92 if resp.search_params['discovery']:
93 json_results = json['results']
94 else:
95 json_results = json
96
97 for result in json_results:
98 item = {'title': result['title']}
99
100 if resp.search_params['discovery']:
101 content_list = [result.get(x) for x in ['abstract', 'summary']]
102 item['url'] = base_url + result['path']
103 item['content'] = html_to_text(' | '.join([x for x in content_list if x]))
104 item['metadata'] = html_to_text(result.get('meta_short', ''))
105
106 if result.get('image'):
107 item['img_src'] = image_url.format(image_id=result['image'], filename=result['image_filename'])
108 else:
109 item['url'] = result['url']
110 item['content'] = ', '.join([result['class'], result['info'], result['more']])
111 item['img_src'] = result['image']
112
113 results.append(item)
114
115 return results

Variable Documentation

◆ about

dict searx.engines.moviepilot.about
Initial value:
1= {
2 'website': "https://www.moviepilot.de",
3 'official_api_documentation': None,
4 'use_official_api': False,
5 'require_api_key': False,
6 'results': 'JSON',
7 'language': 'de',
8}

Definition at line 32 of file moviepilot.py.

◆ base_url

str searx.engines.moviepilot.base_url = "https://www.moviepilot.de"

Definition at line 43 of file moviepilot.py.

◆ categories

list searx.engines.moviepilot.categories = ["movies"]

Definition at line 41 of file moviepilot.py.

◆ filter_types

list searx.engines.moviepilot.filter_types = ["fsk", "genre", "jahr", "jahrzehnt", "land", "online", "stimmung", "person"]

Definition at line 46 of file moviepilot.py.

◆ image_url

str searx.engines.moviepilot.image_url = "https://assets.cdn.moviepilot.de/files/{image_id}/fill/155/223/{filename}"

Definition at line 44 of file moviepilot.py.

◆ paging

bool searx.engines.moviepilot.paging = True

Definition at line 40 of file moviepilot.py.