Giter VIP home page Giter VIP logo

htmlparse-scraper's People

Contributors

maestro00 avatar

Watchers

 avatar

htmlparse-scraper's Issues

HTML Scraping How to Get __RequestVerificationToken value in VB.NET

I am trying to get some datas from https://www.bddk.org.tr/BultenHaftalik this page.(You can put /en to see in English) (Excuse about my English bad)

But i need to Post __RequestVerificationToken with some parameters.

I created a simple GET function to get cookie value and direct it to a Method which provides the Post parameters but i'm getting error page in my HaftalikTaylan_post.Response as <title>Runtime Error</title> this HTML.

On the Top:

` Private HaftalikTaylan As State = New State With {.Url = "http://www.bddk.org.tr/BultenHaftalik/"}
Private __RequestVerificationToken As String = String.Empty
Private HaftalikTaylan_post As State = New State With {.Url = "http://www.bddk.org.tr/BultenHaftalik/tr/Home/KiyaslamaJsonGetir/"}

`
And the methods are:

` Private Sub Deneme()

    Dim client As RestSharp.RestClient = New RestSharp.RestClient(Me.HaftalikTaylan.Url)
    Me.HaftalikTaylan.Request = New RestSharp.RestRequest(RestSharp.Method.GET) With {.Timeout = 5 * 60 * 1000}
    Me.HaftalikTaylan.Response = client.Execute(Me.HaftalikTaylan.Request)

    If Me.HaftalikTaylan.Response.Cookies.Count > 0 Then

        For i As Integer = 0 To Me.HaftalikTaylan.Response.Cookies.Count - 1
            If Me.HaftalikTaylan.Response.Cookies(i).Name.Contains("__RequestVerificationToken_L0J1bHRlbkhhZnRhbGlr0") Then
                __RequestVerificationToken = Me.HaftalikTaylan.Response.Cookies(i).Value
            End If
        Next
    End If
    Me.Deneme_post(__RequestVerificationToken)
End Sub

Private Sub Deneme_post(__RequestVerificationToken As String)


    Dim client As RestSharp.RestClient = New RestSharp.RestClient(Me.HaftalikTaylan_post.Url)
    Me.HaftalikTaylan_post.Request = New RestSharp.RestRequest(RestSharp.Method.POST) With {.Timeout = 5 * 60 * 1000}
    Me.HaftalikTaylan_post.Request.AddHeader("cahce-control", "no-cache")
    Me.HaftalikTaylan_post.Request.AddHeader("content-type", "application/x-www-form-urlencoded")

        Dim parameterString As String = "__RequestVerificationToken=" & __RequestVerificationToken & "&dil=tr&tarih=8.3.2019&id=154&parabirimi=TL&sutun=154&tarafKodu=10001&gun=90"

    Me.HaftalikTaylan_post.Request.AddParameter("application/x-www-form-urlencoded", parameterString, RestSharp.ParameterType.RequestBody)
    Me.HaftalikTaylan_post.Response = client.Execute(Me.HaftalikTaylan_post.Request)

End Sub`

And my response content's is just:

{"Baslik":"Grafik Başlığı","XEkseni":[],"YEkseni":[]}

-Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.