楼主: oliyiyi
1605 1

R Package to access the Open Movie Database (OMDB) API [推广有奖]

版主

已卖:2993份资源

泰斗

1%

还不是VIP/贵宾

-

TA的文库  其他...

计量文库

威望
7
论坛币
117070 个
通用积分
31670.9540
学术水平
1454 点
热心指数
1573 点
信用等级
1364 点
经验
384134 点
帖子
9629
精华
66
在线时间
5508 小时
注册时间
2007-5-21
最后登录
2025-7-8

初级学术勋章 初级热心勋章 初级信用勋章 中级信用勋章 中级学术勋章 中级热心勋章 高级热心勋章 高级学术勋章 高级信用勋章 特级热心勋章 特级学术勋章 特级信用勋章

楼主
oliyiyi 发表于 2015-7-11 18:39:22 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
(This article was first published on rud.is » R, and kindly contributed to R-bloggers)

It’s not on CRAN yet, but there’s a devtools-installable R package for getting data from theOMDB API.

It covers all of the public API endpoints:

  • find_by_id: Retrieve OMDB info by IMDB ID search
  • find_by_title: Retrieve OMDB info by title search
  • get_actors: Get actors from an omdb object as a vector
  • get_countries: Get countries from an omdb object as a vector
  • get_directors: Get directors from an omdb object as a vector
  • get_genres: Get genres from an omdb object as a vector
  • get_writers: Get writers from an omdb object as a vector
  • print.omdb: Print an omdb result
  • search_by_title: Lightweight omdb title search

Here’s a bit of it in action:

devtools::install_github("hrbrmstr/omdbapi")library(dplyr)library(pbapply) search_by_title("Captain America") # Source: local data frame [10 x 4]# # Title Year imdbID Type# 1 Captain America: The First Avenger 2011 tt0458339 movie# 2 Captain America: The Winter Soldier 2014 tt1843866 movie# 3 Captain America 1990 tt0103923 movie# 4 Captain America 1979 tt0078937 movie# 5 Iron Man and Captain America: Heroes United 2014 tt3911200 movie# 6 Captain America II: Death Too Soon 1979 tt0078938 movie# 7 Captain America 1944 tt0036697 movie# 8 Captain America 1966– tt0206474 series# 9 Captain America: Super Soldier 2011 tt1740721 game# 10 Comic Book Origins: Captain America - Winter Soldier 2014 tt3618126 movie search_by_title("Captain America", year_of_release=2013) # Source: local data frame [1 x 4]# # Title Year imdbID Type# 1 A Look Back at 'Captain America' 2013 tt3307378 movie games <- search_by_title("Captain America", type="game") glimpse(games) # Observations: 2# Variables:# $ Title (chr) "Captain America: Super Soldier", "Captain America and the A...# $ Year (chr) "2011", "1991"# $ imdbID (chr) "tt1740721", "tt0421939"# $ Type (chr) "game", "game" find_by_title(games$Title[1]) # Title: Captain America: Super Soldier# Year: 2011# Rated: N/A# Released: 2011-07-19# Runtime: N/A# Genre: Action# Director: Michael McCormick, Robert Taylor# Writer: Christos N. Gage# Actors: Hayley Atwell, Chris Evans, Sebastian Stan, Neal McDonough# Plot: You play the Sentinel of Liberty as you raid the Red Skull's scientist# minion, Armin Zola's, lair.# Language: English# Country: USA# Awards: N/A# Poster: http://ia.media-imdb.com/images/M/# MV5BMTUwMzQ0NjE5N15BMl5BanBnXkFtZTgwODI3MzQxMTE@._V1_SX300.jpg# Metascore: N/A# imdbRating: 7.2# imdbVotes: 271# imdbID: tt1740721# Type: game find_by_title("Game of Thrones", type="series", season=1, episode=1) # Title: Winter Is Coming# Year: 2011# Rated: TV-MA# Released: 2011-04-17# Runtime: 62 min# Genre: Adventure, Drama, Fantasy# Director: Timothy Van Patten# Writer: David Benioff (created by), D.B. Weiss (created by), George R.R.# Martin ("A Song of Ice and Fire" by), David Benioff, D.B.# Weiss# Actors: Sean Bean, Mark Addy, Nikolaj Coster-Waldau, Michelle Fairley# Plot: Jon Arryn, the Hand of the King, is dead. King Robert Baratheon plans# to ask his oldest friend, Eddard Stark, to take Jon's# place. Across the sea, Viserys Targaryen plans to wed his# sister to a nomadic warlord in exchange for an army.# Language: English# Country: USA# Awards: N/A# Poster: http://ia.media-imdb.com/images/M/# MV5BMTk5MDU3OTkzMF5BMl5BanBnXkFtZTcwOTc0ODg5NA@@._V1_SX300.jpg# Metascore: N/A# imdbRating: 8.5# imdbVotes: 12584# imdbID: tt1480055# Type: episode get_genres(find_by_title("Star Trek: Deep Space Nine", season=5, episode=7)) # [1] "Action" "Adventure" "Drama" get_writers(find_by_title("Star Trek: Deep Space Nine", season=4, episode=6)) # [1] "Gene Roddenberry (based upon "Star Trek" created by)"# [2] "Rick Berman (created by)" # [3] "Michael Piller (created by)" # [4] "David Mack" # [5] "John J. Ordover" get_directors(find_by_id("tt1371111")) # [1] "Tom Tykwer" "Andy Wachowski" "Lana Wachowski" get_countries(find_by_title("The Blind Swordsman: Zatoichi")) # [1] "Japan" ichi <- search_by_title("Zatoichi")bind_rows(lapply(ichi$imdbID, function(x) {  find_by_id(x, include_tomatoes = TRUE)})) -> zato par(mfrow=c(3,1)) boxplot(zato$tomatoUserMeter, horizontal=TRUE, main="Tomato User Meter", ylim=c(0, 100))boxplot(zato$imdbRating, horizontal=TRUE, main="IMDB Rating", ylim=c(0, 10))boxplot(zato$tomatoUserRating, horizontal=TRUE, main="Tomato User Rating", ylim=c(0, 5))

You can find out more at it’s github repo


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:database package access Movie Acces

缺少币币的网友请访问有奖回帖集合
https://bbs.pinggu.org/thread-3990750-1-1.html

沙发
longmowx 发表于 2015-7-12 18:50:29
多谢!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-5 15:34