[11] add IMDb Topic Search

pull/909/head
meisnate12 3 years ago
parent 3a655c6d5a
commit ddd16e1e29

@ -1 +1 @@
1.17.0-develop10
1.17.0-develop11

@ -49,7 +49,7 @@ collections:
## IMDb List
Finds every item in an IMDb List, [IMDb Keyword Search](https://www.imdb.com/search/keyword/), or [IMDb Title Search](https://www.imdb.com/search/title/).
Finds every item in an IMDb List, [Keyword Search](https://www.imdb.com/search/keyword/), [Title Search](https://www.imdb.com/search/title/), or [Topic Search](https://www.imdb.com/search/title-text/).
The expected input is an IMDb List URL or IMDb Search URL. Multiple values are supported as a list only a comma-separated string will not work.

@ -22,6 +22,7 @@ base_url = "https://www.imdb.com"
urls = {
"lists": f"{base_url}/list/ls",
"searches": f"{base_url}/search/title/",
"title_text_searches": f"{base_url}/search/title-text/",
"keyword_searches": f"{base_url}/search/keyword/",
"filmography_searches": f"{base_url}/filmosearch/"
}
@ -71,6 +72,9 @@ class IMDb:
elif imdb_url.startswith(urls["searches"]):
xpath_total = "//div[@class='desc']/span/text()"
per_page = 250
elif imdb_url.startswith(urls["title_text_searches"]):
xpath_total = "//div[@class='desc']/span/text()"
per_page = 50
else:
xpath_total = "//div[@class='desc']/text()"
per_page = 50
@ -113,6 +117,8 @@ class IMDb:
if search_url:
params["count"] = remainder if i == num_of_pages else item_count # noqa
params["start"] = start_num # noqa
elif imdb_base.startswith(urls["title_text_searches"]):
params["start"] = start_num # noqa
else:
params["page"] = i # noqa
response = self.config.get_html(imdb_base, headers=headers, params=params)

Loading…
Cancel
Save