I am writing a crawler in ruby, for the movie section of bsvalue website. https://bsvalue.com/category/5f74877a50e0c79d5d58b8a4;categoryTitle=Movies
I am able to get the json, but i don't have idea how to save/print that all the movies name , id, cast etc, one by one using parmas . Can anyone help me in this.
here is the starting of my code which gives me json response
require "net/http"
url = URI("https://blacksheepapi.com/app-v2/api/mobile/home/category/5f74877a50e0c79d5d58b8a4/with-videos?offset=0&limit=40")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authority"] = "blacksheepapi.com"
request["accept"] = "application/json, text/plain, */*"
request["authorization"] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjoiNWZhYjk0NmIxZmVmZWQxN2I1Njc5ZWY4IiwidXNlclR5cGUiOjIsImlzUHJlbWl1bVVzZXIiOmZhbHNlfSwiaWF0IjoxNjA2NzMxMTgzLCJleHAiOjE2MDkzMjMxODN9.bgE8acYdOz5E7pqGLfOEP9D-No8AhJzj_ruYtygLkRU"
request["user-agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
request["origin"] = "https://bsvalue.com"
request["sec-fetch-site"] = "cross-site"
request["sec-fetch-mode"] = "cors"
request["sec-fetch-dest"] = "empty"
request["referer"] = "https://bsvalue.com/"
request["accept-language"] = "en-GB,en-US;q=0.9,en;q=0.8"
request["if-none-match"] = "W/\"7b13-8sXFO/kqq7iWIQEBPNiEsg35CNQ\""
response = https.request(request)
puts response.read_body
json = JSON.parse(response.body)
Aucun commentaire:
Enregistrer un commentaire