وب سرویس دریافت اطلاعات فیلم و سریال TvMaze

وب سرویس TvMaze یک وب سرویس قدرتمند دریافت اطلاعات فیلم و سریال بر اساس کد IMDb و TvMaze سریال ها می باشد. با استفاده از این وب سرویس میتوانید اطلاعات بسیار زیادی از سریال ها را به راحتی دریافت کنید, این وب سرویس که بر پایه جیسون طراحی شده است، می تواند در ۹۹% از وقت شما صرفه جویی کند. دریافت اطلاعات به صورت کامل می باشد که در ادامه بیشتر با این اطلاعات آشنا می شوید.

 

نمونه لینک دریافت اطلاعات سریال بر اساس کد IMDB :

 

http://tv.rizweb.ir/?apikey=YOUR-API-KEY&i=tt123456

نمونه پاسخ دریافتی : 

 

{
id: 82,
url: "/shows/82/game-of-thrones",
name: "Game of Thrones",
type: "Scripted",
language: "English",
genres: [
"Drama",
"Adventure",
"Fantasy"
],
status: "Running",
runtime: 60,
premiered: "2011-04-17",
officialSite: "http://www.hbo.com/game-of-thrones",
schedule: {
time: "21:00",
days: [
"Sunday"
]
},
rating: {
average: 9.3
},
weight: 99,
network: {
id: 8,
name: "HBO",
country: {
name: "United States",
code: "US",
timezone: "America/New_York"
}
},
webChannel: {
id: 22,
name: "HBO Go",
country: {
name: "United States",
code: "US",
timezone: "America/New_York"
}
},
externals: {
tvrage: 24493,
thetvdb: 121361,
imdb: "tt0944947"
},
image: {
medium: "359013.jpg",
original: "359013.jpg"
},
summary: "<p>Based on the bestselling book series <i>A Song of Ice and Fire</i> by George R.R. Martin, this sprawling new HBO drama is set in a world where summers span decades and winters can last a lifetime. From the scheming south and the savage eastern lands, to the frozen north and ancient Wall that protects the realm from the mysterious darkness beyond, the powerful families of the Seven Kingdoms are locked in a battle for the Iron Throne. This is a story of duplicity and treachery, nobility and honor, conquest and triumph. In the <b>Game of Thrones</b>, you either win or you die.</p>",
updated: 1519923089,
_links: {
self: {
href: "/shows/82"
},
previousepisode: {
href: "/episodes/1221415"
}
}
}

پارامتر های ارسالی : 

 

توضیحاتمثالمقدار صحیحلزوم استفادهپارامتر
کد IMDB / TvMaze سریال tt123456IMDB IDاجباریt
API Key دریافت شده از سایتxxxxxxxxxxxxAPI Key اجباریapikey

 

نمونه کد PHP استفاده از این وب سرویس : 

 

<?php

$imdb_id 	= "tt123456";
$api_key 	= "xxxxxx";

$riz_tv 	= file_get_contents("http://tv.rizweb.ir/?apikey={$api_key}&i={$imdb_id}");
$riz_tv 	= json_decode($riz_tv, true);
var_dump($riz_tv);
?>

 

نمونه کد .NET استفاده از این وب سرویس : 

Public Class TVRizObject
    Public Property Status As TVRizMazeStatus
    Public Property GetJson As String = String.Empty
    Public Property GetInfo As Integer = 0
    Public Property Timestamp As String = String.Empty
    Public Property Key As String = String.Empty
    Public Property localPath As String = String.Empty
End Class



Private Function postTVRizMaze(ByVal fileStream As Stream, filename As String, Optional intHeight As Integer = 0, Optional intWith As Integer = 0) As System.IO.Stream
    Dim objResponse() As TVRizMazeObject
    Try
        Dim strURL As String = FunGlob.AppsettingsSACS.GetKey("TVRizMaze.URL")
        Dim strAPI As String = FunGlob.AppsettingsSACS.GetKey("TVRizMaze.API")
        Dim blnIMDb As Boolean = (FunGlob.AppsettingsSACS.GetKey("TVRizMaze.IMDb") = "1")
        Dim wait As Integer = 15

        Integer.TryParse(FunGlob.AppsettingsSACS.GetKey("TVRizMaze.Wait"), wait)
        If wait = 0 Then wait = 15

        Dim imageBytesContent As HttpContent = New ByteArrayContent(imgToByteArray(fileStream))
        imageBytesContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream")

        Using client As HttpClient = New HttpClient()
            client.DefaultRequestHeaders.Accept.Clear()

            Using formData = New MultipartFormDataContent()
                formData.Add(New StringContent(strAPI), "key")
                If blnIMDb Then
                    formData.Add(New StringContent("1"), "IMDb")
                Else
                    formData.Add(New StringContent("0"), "IMDb")
                End If
                formData.Add(New StringContent(wait), "wait")
                If intHeight > 0 Or intWith > 0 Then
                    formData.Add(New StringContent("1"), "resize")
                    If intHeight > 0 Then
                        formData.Add(New StringContent(intHeight), "resize_height")
                    End If
                    If intWith > 0 Then
                        formData.Add(New StringContent(intWith), "resize_width")
                    End If
                Else
                    formData.Add(New StringContent(0), "resize")
                End If
                formData.Add(New StringContent("{""file1"": """ & filename & """}"), "file_paths")
                formData.Add(imageBytesContent, "file1", filename)

                Dim response = client.PostAsync(strURL, formData).Result
                Dim responseContent = response.Content.ReadAsStringAsync().Result

                If Not responseContent Is Nothing Then
                    objResponse = JsonConvert.DeserializeObject(Of TVRizMazeObject())(responseContent)

                    If Not objResponse Is Nothing AndAlso objResponse.Length > 0 Then
                        If (objResponse(0).Status.Code = 1 Or objResponse(0).Status.Code = 2) Then
                            If objResponse(0).Status.Code = 2 And Len(objResponse(0).IMDbURL) > 0 Then
                                Using webClient As WebClient = New WebClient()
                                    Dim imageBytes As Byte() = webClient.DownloadData(objResponse(0).IMDbURL)
                                    If imageBytes.Length > 0 Then
                                        Return New MemoryStream(imageBytes)
                                    End If
                                End Using
                            Else
                                Return Nothing
                            End If
                        Else
                            Return Nothing
                        End If
                    Else
                        Return Nothing
                    End If
                Else
                    Return Nothing
                End If
            End Using
        End Using
    Catch ex As Exception
        Return Nothing
    End Try

    Return Nothing

End Function

 

 

دریافت API Key جهت استفاده از وب سرویس :

 

۳ ماهه ۶ ماهه
150,000 ریال – خرید
250,000 ریال – خرید

دسته بندی