烂番茄客户

rotten_tomatoes_client的Python项目详细描述


简介

我认为烂西红柿是一种很好的服务。所以我想试着 处理几个项目(如命令行工具),这些项目包括 数据来自腐烂的西红柿。

对现有腐烂番茄蟒的粗略调查 客户(比如 rottentomatoesrtsimple)我注意到两件事:

  1. 每个客户端都需要一个api密钥才能使用(这是合理的)
  2. 腐烂的西红柿原料药很难获得(更少 合理)。

例如:

Rotten Tomatoes is no longer issuing API keys at the time of registration. We will review each application to ensure the usage of our data aligns with Brand Guidelines and Terms of Service and will provision keys if approved. There is now a license fee to access the API details of which will be provided upon application approval. The approval process may take up to 60 days. Thank you for your patience.

From this GitHub issue

Thank you for your interest in the Rotten Tomatoes API. API users have access to our existing API, which provides full access to Rotten Tomatoes Scores and Reviews Snippets (up to 20), for an annual fee which starts at $60,000.

From this Reddit thread

不那么私有的公共api

如果您转到“Certified Fresh Movies” page

alt-text

alt文本

打开浏览器中的Networktab/development控制台, 您可以看到httpGET请求,如

https://www.rottentomatoes.com/api/private/v2.0/browse?minTomato=70&maxTomato=100&maxPopcorn=100&services=amazon%3Bhbo_go%3Bitunes%3Bnetflix_iw%3Bvudu%3Bamazon_prime%3Bfandango_now&certified=true&sortBy=popularity&type=cf-in-theaters

它返回一个JSON响应,看起来像

{"counts":{"count":14,"total":14},"debugUrl":"http://rt-client-facade-v2-6-1.aws.prod.flixster.com/list/top-box-office/movies?expand=true&include=%5B%22movieSupplementaryInfo%22%2C%22audienceSummary%22%2C%22affiliates%22%2C%22criticSummary%22%2C%22genres%22%2C%22moviePersonnel%22%2C%22moviePersonnel.actors%22%2C%22moviePersonnel.actors.person%22%5D&page=%7B%22limit%22%3A1000%7D","results":[{"actors":["Chris Pratt","Zoe Saldana","Dave Bautista"],"id":771385707,"mainTrailer":{"id":"11295755","sourceId":"http://link.theplatform.com/s/NGweTC/media/dFLWRKu5WPrE"},"mpaaRating":"PG13","popcornIcon":"upright","popcornScore":90,"posters":{"primary":"https://resizing.flixster.com/Qjh201ZZ1tydptY1QVjOJrYVAis=/130x0/v1.bTsxMjMyMzE1NjtwOzE3MzMyOzEyMDA7NTkxOzg3Ng","thumborId":"v1.bTsxMjMyMzE1NjtwOzE3MzMyOzEyMDA7NTkxOzg3Ng"},"runtime":"2 hr. 17 min.","synopsis":"<em>Guardians of the Galaxy Vol. 2</em>'s action-packed plot, dazzling visuals, and irreverent humor add up to a sequel that's almost as fun -- if not quite as thrillingly fresh -- as its predecessor.","synopsisType":"consensus","theaterReleaseDate":"May 5","title":"Guardians of the Galaxy Vol. 2","tomatoIcon":"certified_fresh","tomatoScore":81,"url":"/m/guardians_of_the_galaxy_vol_2"},{"actors":["Michael Fassbender","Katherine Waterston","Billy Crudup"],"id":771377268,"mainTrailer":{"id":"11295756","sourceId":"http://link.theplatform.com/s/NGweTC/media/fpqxfaxTIQdB"},"mpaaRating":"R","popcornIcon":"upright","popcornScore":61,"posters":{"primary":"https://resizing.flixster.com/S2SZABT3ghBipL-urqBzBqhUs-E=/130x0/v1.bTsxMjM0NTY3NjtqOzE3MzMyOzEyMDA7NTM5OzgwMA","thumborId":"v1.bTsxMjM0NTY3NjtqOzE3MzMyOzEyMDA7NTM5OzgwMA"},"runtime":"2 hr. 0 min.","synopsis":"<em>Alien: Covenant</em> delivers another satisfying round of close-quarters deep-space terror, even if it doesn't take the saga in any new directions.","synopsisType":"consensus","theaterReleaseDate":"May 19","title":"Alien: Covenant","tomatoIcon":"certified_fresh","tomatoScore":71,"url":"/m/alien_covenant"},...]}

实际上,我已经找到了1的这些“公共”端点。浏览电影 &本周开幕的电视节目,顶级DVD和流媒体,今晚的新电视, 等等2。搜索*关键字搜索电影、特许经营、演员、电视 节目等。

我已找到给定电影/电视节目/演员的not终结点 很烦人。

客户机

显然,使用一个有限的(已知的)api,将有一个同样有限的 客户端接口。另外,不用说 不是官方支持的api,不能保证 这个客户的可靠性。

安装

pip install rotten_tomatoes_client

浏览电视节目

浏览电视节目只有三个类别(位于 TvBrowsingCategoryenum)*new_tv_tonight*most_popular *certified_fresh

`browse_tv_shows 方法<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/client.py#L23-L31>;。`_ 接受a``tvbrowsingcategory` 值<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L4-L7>;`。 如果未提供,则默认使用 `TvBrowsingCategory.most_popular<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L6>;``。

fromrotten_tomatoes_clientimportRottenTomatoesClient,TvBrowsingCategoryresult=RottenTomatoesClient.browse_tv_shows(category=TvBrowsingCategory.most_popular)# The result will look something like this# {#   "counts": {#     "count": 16,#     "total": 16#   },#   "results": [#     {#       "posters": {#         "primary": "https://resizing.flixster.com/OcgpKual3yhynPR3ZbNl1NfHwUE=/2000x3000/v1.dDsyNTQ3OTI7ajsxNzMyNzsxMjAwOzIwMDA7MzAwMA"#       },#       "title": "Twin Peaks: The Return",#       "tomatoIcon": "certified",#       "tomatoScore": 95,#       "url": "/tv/twin_peaks/s03"#     },#     {#       "posters": {#         "primary": "https://resizing.flixster.com/ON_GjiBNjJ8InbhnRnr0wCNKGAQ=/2048x3072/v1.dDsyNTI5MDY7ajsxNzMyNzsxMjAwOzIwNDg7MzA3Mg"#       },#       "title": "American Gods: Season 1",#       "tomatoIcon": "certified",#       "tomatoScore": 96,#       "url": "/tv/american_gods/s01"#     },#     ...#   ],#   "title": "Most Popular TV on RT"# }

浏览电影

`browse_movies 方法<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/client.py#L23-L31>;。`_ 接受 ``电影浏览查询`<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/client.py#L23-L31>;。`_ 它由以下参数组成*minimum_rating* 允许的最小Rottentomotoes分数*默认为^{TT18}$* {TT19}$*最大允许RuttOnMixRead *默认值 将100*services*alist的任何枚举 值<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L10-L17>;。`_ 喜欢 `Service.amazon<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L11>;。`_ 或 `Service.netflix<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L14>;``。 *默认为所有流选项。*certified_fresh*a} boolean,表示电影是否是 应考虑“认证新鲜”。*默认为False* genres*alist任何一个 值<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L37-L49>;。`_ 喜欢 `Genre.action<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L38>;。`_ 或 `Genre.comedy<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L42>;``。 *默认为所有流派。*sort_by*可以按 使用sortby` 枚举https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L20-L22>;`。 *默认按流行度排序*category*表示 要筛选的电影类型,例如在中打开的电影 或者最近已经发行了DVD/流媒体。*采取 “moviebrowsingcategory”枚举 值<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L25-L34>;。`_ 喜欢 `MovieBrowsingCategory.certified_fresh_in_theaters<;https://github.com/jaebradley/rotten_tomatoes_client/blob/master/rotten_tomatoes_client/query/parameters/browsing.py#L29>;``。

fromrotten_tomatoes_clientimportRottenTomatoesClient,MovieBrowsingQuery,Service,Genre,SortBy,MovieBrowsingCategory# Give me some relatively shitty action, comedy, or romance movies on Netflix or Amazon Prime, sorted by popularityquery=MovieBrowsingQuery(minimum_rating=35,maximum_rating=70,services=[Service.netflix,Service.amazon_prime],certified_fresh=False,genres=[Genre.action,Genre.comedy,Genre.romance],sort_by=SortBy.popularity,category=MovieBrowsingCategory.all_dvd_and_streaming)result=RottenTomatoesClient.browse_movies(query=query)# The result will look something like this# {#   "counts": {#     "count": 32,#     "total": 771#   },#   "results": [#     {#       "id": 10180,#       "title": "10 Things I Hate About You",#       "url": "/m/10_things_i_hate_about_you",#       "tomatoIcon": "fresh",#       "tomatoScore": 61,#       "popcornIcon": "upright",#       "popcornScore": 69,#       "theaterReleaseDate": "Mar 31",#       "dvdReleaseDate": "Oct 12",#       "mpaaRating": "PG13",#       "synopsis": "Julia Stiles and Heath Ledger add strong performances to an unexpectedly clever script, elevating 10 Things (slightly) above typical teen fare.",#       "synopsisType": "consensus",#       "runtime": "1 hr. 37 min.",#       "posters": {#         "thumborId": "v1.bTsxMTIwNzQ3NTtqOzE3NDA5OzEyMDA7MTgwMDsyNDAw",#         "primary": "https://resizing.flixster.com/J0m170tQD8igSYaxp2rtyd5N8wU=/130x0/v1.bTsxMTIwNzQ3NTtqOzE3NDA5OzEyMDA7MTgwMDsyNDAw"#       },#       "actors": [#         "Larisa Oleynik",#         "Julia Stiles",#         "Heath Ledger"#       ]#     },#     {#       "id": 12852,#       "title": "Love Actually",#       "url": "/m/love_actually",#       "tomatoIcon": "fresh",#       "tomatoScore": 63,#       "popcornIcon": "upright",#       "popcornScore": 72,#       "theaterReleaseDate": "Nov 7",#       "dvdReleaseDate": "Apr 27",#       "mpaaRating": "R",#       "synopsis": "A sugary tale overstuffed with too many stories. Still, the cast charms.",#       "synopsisType": "consensus",#       "runtime": "2 hr. 15 min.",#       "mainTrailer": {#         "sourceId": "http://link.theplatform.com/s/NGweTC/media/yHqz_0l_lb0V",#         "id": "11295544"#       },#       "posters": {#         "thumborId": "v1.bTsxMTE3NDgyMjtqOzE3NDA5OzEyMDA7ODAwOzEyMDA",#         "primary": "https://resizing.flixster.com/V2-mrbEXdlXN269WjQ_pcuPpNXQ=/130x0/v1.bTsxMTE3NDgyMjtqOzE3NDA5OzEyMDA7ODAwOzEyMDA"#       },#       "actors": [#         "Bill Nighy",#         "Hugh Grant",#         "Liam Neeson"#       ]#     },#     {#       "id": 2864421,#       "title": "Hoodwinked",#       "url": "/m/1155109-hoodwinked",#       "tomatoIcon": "rotten",#       "tomatoScore": 46,#       "popcornIcon": "spilled",#       "popcornScore": 56,#       "theaterReleaseDate": "Jan 13",#       "dvdReleaseDate": "May 2",#       "mpaaRating": "PG",#       "synopsis": "This fractured fairytale doesn't have the wit or animation quality to compete with the likes of the <i>Shrek</i> franchise.",#       "synopsisType": "consensus",#       "runtime": "1 hr. 20 min.",#       "posters": {#         "thumborId": "v1.bTsxMTIwOTMwNDtqOzE3NDA5OzEyMDA7MTUzNjsyMDQ4",#         "primary": "https://resizing.flixster.com/Nra17Z2DFslffNklaVkXaGmSmw4=/130x0/v1.bTsxMTIwOTMwNDtqOzE3NDA5OzEyMDA7MTUzNjsyMDQ4"#       },#       "actors": [#         "Glenn Close",#         "Anne Hathaway",#         "Jim Belushi"#       ]#     },#     ...#   ]# }

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
解释java选择方法   连接到127.0.0.1的java间歇性故障,连接到IP(eth0)时没有故障   java如何优雅地杀死hadoop作业/intercept`hadoop作业杀死`   java如何通过引导类加载器以编程方式加载另一个类?   url Java:在查询参数之前使用片段构建URI   在BroadLeaf表blc_order_属性中保存OrderAttributes值时发生java错误   安卓将功能从xml转换为java   java如何将数据写入文件?   java JPA SQL结果映射   Java中整数对象比较运算符的引用安全性   Spring测试失败:java。lang.NoClassDefFoundError:org/springframework/cglib/transform/impl/memorysafuendecaredthrowableStrategy   rich:extendedDataTable中的java行选择和数据处理   java为什么我需要在volatile上对多个线程使用synchronized?   java尽管构建成功,但为什么会出现此错误?   数组$ArrayList不能转换为java。util。java中的ArrayList   java如何根据泛型类型调用方法?   java将JLabel添加到JPanel,将JPanel添加到JFrame   如果MapStruct中的源为null,则java将父目标设置为null   JavaJBossDrools从DRL插入事实   java不同的JRE安装(windows)