json - Webscraping 本地 Web 应用程序,尝试使用 Powershell 更新 JSON 对象
问题描述
我正在做一个项目。我有一个从网络抓取中提取的 JSON 对象。网络是我正在处理的内容的 html 版本,用于查看当前电影以及是否将其添加到我的 IMDB 观看列表中。:
{
"title": "The Gallows Act II",
"alternativeTitles": [],
"secondaryYearSourceId": 0,
"sortTitle": "gallows act ii",
"status": "released",
"overview": "When Ana Rue transfers to a prestigious
new acting school, she encounters a malevolent spirit after participating in a viral challenge.",
"inCinemas": "2019-10-25T05:00:00Z",
"physicalRelease": "2019-10-25T00:00:00Z",
"physicalReleaseNote": "",
"images": [
{
"coverType": "poster",
"url": "/MediaCover/54956/poster.jpg"
},
{
"coverType": "fanart",
"url": "/MediaCover/54956/fanart.jpg"
}
],
"website": "",
"year": 2019,
"studio": "Tremendum Pictures",
"profileId": 1,
"pathState": "dynamic",
"monitored": true,
"minimumAvailability": "inCinemas",
"isAvailable": true,
"runtime": 99,
"lastInfoSync": "2020-01-28T16:40:11.982967Z",
"cleanTitle": "thegallowsactii",
"imdbId": "tt7473716",
"tmdbId": 505060,
"titleSlug": "the-gallows-act-ii-505060",
"genres": [],
"tags": [],
"ratings": {
"votes": 12,
"value": 5.3
},
$address="http://localhost:PORT"
$movie_id = ""
#$movie_title = Read-Host "Movie Title"
$params = @{"name"="RescanMovie";"movieId"="$movie_id";} | ConvertTo-Json
$apikey = 'APIKEY FOR APPLICATION'
$converted = Invoke-WebRequest -URI "$address/api/movie/" -Method GET/(10) -UseBasicParsing -Header @{"X-Api-Key" = $apikey}
$converted
#$convertto = Invoke-WebRequest -URI "$address/api/movie/" -Method PUT -UseBasicParsing -Header @{"X-Api-Key" = $apikey}
现在我使用 API pull 提取这些信息:Invoke-Webrequest。
- 我得到了对象。
- 如果它在列表中,我想更改“受监控”,我想分别将其更改为 false 或 true。
- 我将对象分解为初始搜索“受监控”为 -eq true。
- 它把他们拉进来。
- 我想提取所有字段的 JSON 信息”如果在列表中找到受监控状态,则将其更新为 true 或 false。-然后将所有字段传递回 json 对象并更新它。
然而。我不确定如何在 powershell 中执行 POST 命令来更新整个列表并将其传回。
解决方案
推荐阅读
- python - 用列表选择一维多维数组 - numpy
- swiftui - NavigationView / NavigationLink 自定义过渡方向
- python - 如何使用 pandas 导出突出显示的结果?
- html - 如何切换输入复选框?
- java - 是否有算术加法的 Java 方法参考?
- snowflake-cloud-data-platform - 雪花:[42000][904] SQL 编译错误
- php - 如何在公司代理后面安装 PECL 包?
- sql-server - 使用 SSIS 从所有现有 Excel 工作表中导入指定的单元格
- algorithm - 我需要一个考虑限制的团队建设算法
- typescript - Typescript tsconfig 不遵守 noUnusedLocal 规则