csfd_search: Advanced Search

csfd_searchR Documentation

Advanced Search

Description

Search pages on CSFD.

  • use csfd_search_titles() to search for titles

  • use csfd_search_creators() to search for creators

  • use csfd_search_ranks() to search rankings

  • use csfd_search_options() to review search parameters

Usage

csfd_search_titles(
  type = NULL,
  additional = NULL,
  genre = NULL,
  origin = NULL,
  released = NULL,
  rating = NULL,
  fields = NULL,
  page = 1,
  sort = c("rated", "rating_average", "rating_average_asc", "fanclub_count", "year",
    "year_asc"),
  quiet = FALSE
)

csfd_search_creators(
  type = NULL,
  additional = NULL,
  born = NULL,
  born_in = NULL,
  died = NULL,
  died_in = NULL,
  gender = NULL,
  page = 1,
  sort = c("fanclub_count", "birth_date_asc", "birth_date"),
  quiet = FALSE
)

csfd_search_ranks(
  type = NULL,
  origin = NULL,
  released = NULL,
  actor = NULL,
  director = NULL,
  genre = NULL,
  page = 1,
  quiet = FALSE
)

csfd_search_options(domain, element, choices = Inf, single = FALSE)

Arguments

type, additional

A vector of checkbox names/dropdown options.

genre, origin

For csfd_search_ranks(), a string, e.g. "Polsko" or "tv_show".

For csfd_search_titles(), a named list. Examples:

  • use list(any = c("Fantasy", "Film-Noir")) to get Fantasy or Film-Noir

  • use list(all = c("Fantasy", "Film-Noir")) to get films which are both Fantasy AND Film-Noir

  • use list(exact = c("Fantasy", "Film-Noir")) for films which are exactly Fantasy AND Film-Noir and nothing else

If you use either any or all, you can combine it with not like so:

  • use list(not = c("Horor", "Sci-fi")) to exclude Horror and Sci-fi genres from the selection.

released, rating

A vector of 1 to 2 integers (or NULL). Examples:

  • use 2020 to get films released in 2020 or later

  • use c(50, 80) to get films rated between 50% and 80%

fields

A named list of numerical identifiers. Examples:

  • use list(actor = c(483, 486), tag = 800) to search for titles starring Leonard Nimoy (tvurce/453) and William Shatner (tvurce/486), tagged "Star Trek" (tag id 800).

page

Which page to retrieve.

sort

How to sort results.

quiet

If TRUE, request status will not be printed on the console.

born, died

A vector of date strings. Examples:

  • use c("01.01.1950", "31.12.2022) to search creators born between these dates

  • use "500 BC" to search creators born 500 BC - useful for creators such as Euripides

born_in, died_in

A single country name.

gender

One of: "male", "female", 1, 2 or NULL.

actor, director

A vector of integer identifiers, obtained from creator's page URL.

domain, element, choices

Useful for displaying options for search forms. Example:

  • use csfd_search_options("title", "genre", Inf) for a complete list of valid genres

  • use csfd_search_options("title", "origin", "USA") to see if "USA" is a valid origin

single

If TRUE, only vectors of length 1 will be accepted.

Value

An object of class csfd_scraper or, in case of csfd_search_options(), a list.

Results

The result of the search call is a csfd_scraper object with two items:

  1. results: A data frame with search results, including unique identifier.

  2. paginator: A data frame with next_url column, which redirects to the next page of results; if a missing value, it indicates there are no more results.

Examples


## Not run: 

# Search for films and TV shows made in the US only, either drama or sci-fi
# (and possibly other things except horror), rated at least 80 and made
# between 2000 and 2022 (included).
re <- csfd_search_titles(
  type = c("film", "tv_show"),
  origin = list(exact = "USA"),
  genre = list(any = c("Drama", "Sci-Fi"), not = c("horor")),
  rating = 80,
  released = c(2000, 2022)
)

re$results

# As there are more results than would fit a single page, retrieve the next
# page URL and use csfd_fetch() to get those.
re$paginator$next_url %>% csfd_fetch()

# Search rankings of movies filmed in Asia between 1980-2022, starring Donnie
# Yen and Michelle Yeoh.
re <- csfd_search_ranks(
  type = "film",
  origin = "Asie",
  released = c(1980, 2022),
  # This vector does not have to be named, but it's nice for clarity.
  actor = c("Donnie Yen" = 39, "Michelle Yeoh" = 1818),
  genre = "Akční"
)

re$results

## End(Not run)

jchrom/csfd documentation built on Oct. 26, 2022, 10:19 p.m.